add pre_delete function