Fix issues with iterators