Fixed primitive delete function