changed solveLinear logic