Fix an error in the solver-while loop