Fixed segmentation fault from deleting iterators