fixed crash when iterator.next() is called past the end