Fixed bug with multiple GROUP BY values