bug fix avg covariance