Add tests for count & groupBy, and fix groupBy