bug fixed: I now use the cov function instead of manually computing X^t X