fix covariance matrix routine (calccovar.m)