clear function branch when function closed