Fix generate covariance bug