fixed all stuff up to aggregation.