Fixing getAverage