fixed sorting bug for groups too