fixed bug where changing the size of the data is not accounted for while averaging