fix family sorting and spouse merging