Fixed incorrect pagination (wrong records count) when groupBy() is involved