limit the number of iterations