set number of iterations to be run correctly (thanks Alex)