fix grouping by both subject and activity