attempt to fix average calculations