fixed bug in cov calculation