fixing average issue