fixing averaging
fixing averaging