Using maxfun when maxiter is not available