fix total average method bug