Fix incorrect handling of groups.