added safe deleting