Fixed a bug in aggregations.