Index: /Users/amckean/Desktop/trunk/jruby/src/org/jruby/RubyNil.java
===================================================================
--- /Users/amckean/Desktop/trunk/jruby/src/org/jruby/RubyNil.java	(revision 4049)
+++ /Users/amckean/Desktop/trunk/jruby/src/org/jruby/RubyNil.java	(working copy)
@@ -42,16 +42,14 @@
  * @author  jpetersen
  */
 public class RubyNil extends RubyObject {
-    private final Ruby runtime;
     
     public RubyNil(Ruby runtime) {
         super(runtime, runtime.getNilClass(), false);
-        this.runtime = runtime;
         flags |= NIL_F | FALSE_F;
     }
     
     public Ruby getRuntime() {
-        return runtime;
+        return Ruby.getCurrentInstance();
     }
     
     public static ObjectAllocator NIL_ALLOCATOR = new ObjectAllocator() {
Index: /Users/amckean/Desktop/trunk/jruby/src/org/jruby/RubyObject.java
===================================================================
--- /Users/amckean/Desktop/trunk/jruby/src/org/jruby/RubyObject.java	(revision 4049)
+++ /Users/amckean/Desktop/trunk/jruby/src/org/jruby/RubyObject.java	(working copy)
@@ -73,7 +73,8 @@
     public static final IRubyObject NEVER = new RubyObject();
     
     // The class of this object
-    protected RubyClass metaClass;
+	transient protected RubyClass metaClass;   
+	protected String metaClassName;
 
     // The instance variables of this object.
     protected Map instanceVariables;
@@ -110,7 +111,7 @@
         return (flags & flag) != 0;
     }
     
-    private Finalizer finalizer;
+	transient private Finalizer finalizer;
     
     public class Finalizer implements Finalizable {
         private long id;
@@ -152,6 +153,9 @@
 
     protected RubyObject(Ruby runtime, RubyClass metaClass, boolean useObjectSpace) {
         this.metaClass = metaClass;
+		if(metaClass != null) {
+			this.metaClassName = metaClass.classId;
+		}
 
         // Do not store any immediate objects into objectspace.
         if (useObjectSpace) runtime.getObjectSpace().add(this);
@@ -253,7 +257,7 @@
      * @return Value of property ruby.
      */
     public Ruby getRuntime() {
-        return metaClass.getRuntime();
+		return getMetaClass().getRuntime();
     }
     
     public boolean safeHasInstanceVariables() {
@@ -299,11 +303,17 @@
      *
      */
     public final RubyClass getMetaClass() {
-        return metaClass;
+		if(metaClass == null && metaClassName != null) {
+			metaClass = Ruby.getCurrentInstance().getClass(this.metaClassName) ;
+		}
+		return metaClass;
     }
 
     public void setMetaClass(RubyClass metaClass) {
         this.metaClass = metaClass;
+		if(this.metaClass != null) {
+			metaClassName = metaClass.classId;
+		}
     }
 
     /**
Index: /Users/amckean/Desktop/trunk/jruby/src/org/jruby/Ruby.java
===================================================================
--- /Users/amckean/Desktop/trunk/jruby/src/org/jruby/Ruby.java	(revision 4049)
+++ /Users/amckean/Desktop/trunk/jruby/src/org/jruby/Ruby.java	(working copy)
@@ -117,6 +117,7 @@
  * The jruby runtime.
  */
 public final class Ruby {
+	private static ThreadLocal currentRuntime = new ThreadLocal();
     private static String[] BUILTIN_LIBRARIES = {"fcntl", "yaml", "yaml/syck", "jsignal" };
 
     private CacheMap cacheMap = new CacheMap();
@@ -255,9 +256,18 @@
     public static Ruby newInstance(RubyInstanceConfig config) {
         Ruby ruby = new Ruby(config);
         ruby.init();
+		setCurrentInstance(ruby);
         return ruby;
     }
 
+	public static Ruby getCurrentInstance() {
+		return (Ruby)currentRuntime.get();
+	}
+
+	public static void setCurrentInstance(Ruby current) {
+		currentRuntime.set(current);
+	}
+
     /**
      * Returns a default instance of the JRuby runtime configured with the given input, output and error streams.
      *
Index: /Users/amckean/Desktop/trunk/jruby/src/org/jruby/RubyModule.java
===================================================================
--- /Users/amckean/Desktop/trunk/jruby/src/org/jruby/RubyModule.java	(revision 4049)
+++ /Users/amckean/Desktop/trunk/jruby/src/org/jruby/RubyModule.java	(working copy)
@@ -93,7 +93,7 @@
 
     // ClassId is the name of the class/module sans where it is located.
     // If it is null, then it an anonymous class.
-    private String classId;
+    protected String classId;
 
     // All methods and all CACHED methods for the module.  The cached methods will be removed
     // when appropriate (e.g. when method is removed by source class or a new method is added
Index: /Users/amckean/Desktop/trunk/jruby/src/org/jruby/RubyBoolean.java
===================================================================
--- /Users/amckean/Desktop/trunk/jruby/src/org/jruby/RubyBoolean.java	(revision 4049)
+++ /Users/amckean/Desktop/trunk/jruby/src/org/jruby/RubyBoolean.java	(working copy)
@@ -42,15 +42,12 @@
  * @author  jpetersen
  */
 public class RubyBoolean extends RubyObject {
-    private final Ruby runtime;
     
     public RubyBoolean(Ruby runtime, boolean value) {
         super(runtime, (value ? runtime.getClass("TrueClass") : runtime.getClass("FalseClass")), // Don't initialize with class
                 false); // Don't put in object space
 
         if (!value) flags = FALSE_F;
-        
-        this.runtime = runtime;
     }
     
     public int getNativeTypeIndex() {
@@ -58,7 +55,7 @@
     }
     
     public Ruby getRuntime() {
-        return runtime;
+		return Ruby.getCurrentInstance();
     }
     
     public boolean isImmediate() {
