Fix try to get property of non-object, when deleting model