Fix a bug when copied iterators became invalid.