correct the calculation in mean method