Fixed the issue with averages