Fix getAverage method.