      th->safe = ruby_safe_level;
  
      th->node = ruby_current_node;
-+    if (th->sandbox_save != NULL)
++    if (ruby_sandbox_save != NULL)
 +    {
-+      th->sandbox_save(th);
++      ruby_sandbox_save(th);
 +    }
  }
  

 	rb_define_global_const("TOPLEVEL_BINDING", rb_f_binding(ruby_top_self));
 #ifdef __MACOS__
 	_macruby_init();
@@ -1437,6 +1426,8 @@
 static int thread_set_raised();
 static int thread_reset_raised();
 

 #endif
 
     rb_trap_immediate = 0;	/* inhibit interrupts from here */
+    if (ruby_sandbox_restore != NULL)
+    {
+      ruby_sandbox_restore(th);
+    }
     ruby_frame = th->frame;
     ruby_scope = th->scope;
