delete function fix