Fix bug in serialization of iterators.