Fixed a bug related to aggregating calculations