minor fix to covariance function, added appendstring etc