added check for instance id when deleting parents