Added some more fixes to group by