iterator incorrectly tried to count the items in the stack to see if there were still items in to include in the iteration proces