Fix statistics calculation.