Fix unsafe iterator behavior.  Once the iterator is erased, it is invalid and cannot be used.  It needs to be replaced by the iterator returned by erase().