fixed bug in sorted array with iterators