fixed bug in AdaptToIterator