optimized aggregation #1168