check if pbject exists before deleting it