fixing an error where groups would be empty.