fixed error in merge_data