delete function fixing