fix db_sync bugs in testing