Fixed memory leak when re-pass the iterator