Reset iteration after a crash

Reset the iteration counter after a crash happens.