delete function fixed