foreach: fix case where iterators are not on the stack.