bug fix for normalizing the covariance matrix