Fixed aggregation maths

Fixed issue where only last value in chunk was being checked.