making sure group_by is defined