Fixed QR factorization bug