Fix a couple of bugs in Aggregate featre after testing on a larger dataset