Make sure aggregated values that can be integers are integers
Fix bug with COUNT aggregations

The reduce function for count was not idempotent
Merge pull request #101 from cndreisbach/bugfix-415

Fix for aggregation producing incorrect results in incorrect format