fixed assertion in group_by