Finished this script

minor bugfix to Aggregation script