erase() method bug fixed