Fixed some aggregation refactotring problems.