updated code that checks cov matrices