fixing join grouping