fix bugs in data_aggregator.py; take less memory and save running time.