Group by is now working properly.