Fixed logic of group selection.