Bug fix for maxiter