Fix for correct merging of groups.