Fixed some bugs of aggregation