Fixing groups so that an empty group is not created.