fixed critical error

delete & erase didn't check range.