a more correct linsolve