Fix bug with crashing iterators while deleting.