Fixed avg calculating. #6