added error message and final iteration attempt for failed convergence