fixed some bugs with aggregated data