repair delete function