Get last state

These modifications provide a way to get the last parameters of the solver when it fails to reach a solution.