fix the mapping merge code which was half baked