Fixed issues with iterators