when i > nmax, maximum number of iterations reached
Merge pull request #29 from yulijia/master

Avoid warning twice