fixed a problem deleting the last node