Fix bug in group_by where incomplete groups were dropped.