Fixed an iteration overflow bug