fix error reporting in merge_from_db