fixed bug in spherical averaging method (i.e. f(x,y,z)->f(r))