Fixed a bug which occured while aggregating.