fixed bug with np.average