Fixed linear algebra error