covariance calculation had a bug