sort out the remote db handling