      /* init thread core */
      {
  	/* main thread setting */
-@@ -4846,4 +4881,3 @@ rb_reset_coverages(void)
+@@ -4846,4 +4948,3 @@ rb_reset_coverages(void)
      GET_VM()->coverages = Qfalse;
      rb_remove_event_hook(update_coverage);
  }

 	    }
 	}
     }
@@ -4404,6 +4435,7 @@ set_trace_func(int argc, VALUE *argv)
     }
 
     if (NIL_P(trace)) {
+	GET_THREAD()->exec_event_tracing = 0;
 	GET_THREAD()->tracing = EVENT_RUNNING_NOTHING;
 	return Qnil;
     }
@@ -4592,6 +4592,67 @@ thread_suppress_tracing(rb_thread_t *th, int ev, VALUE (*func)(VALUE, int), VALU
     return result;
 }
 

 /*
  *  call-seq:
  *     thr.backtrace    -> array
@@ -4713,6 +4807,14 @@ Init_Thread(void)
     rb_define_method(rb_cThread, "set_trace_func", thread_set_trace_func_m, 1);
     rb_define_method(rb_cThread, "add_trace_func", thread_add_trace_func_m, 1);
 
