Index: src/main/java/org/jboss/ejb3/remoting/IsLocalInterceptor.java
===================================================================
--- src/main/java/org/jboss/ejb3/remoting/IsLocalInterceptor.java	(revision 106735)
+++ src/main/java/org/jboss/ejb3/remoting/IsLocalInterceptor.java	(working copy)
@@ -21,11 +21,9 @@
  */
 package org.jboss.ejb3.remoting;
 
-import java.io.Serializable;
-import java.util.Map;
-
 import org.jboss.aop.advice.Interceptor;
 import org.jboss.aop.joinpoint.Invocation;
+import org.jboss.aop.joinpoint.InvocationResponse;
 import org.jboss.aop.util.PayloadKey;
 import org.jboss.ejb3.Container;
 import org.jboss.ejb3.Ejb3Registry;
@@ -33,6 +31,9 @@
 import org.jboss.logging.Logger;
 import org.jboss.serial.io.MarshalledObjectForLocalCalls;
 
+import java.io.IOException;
+import java.io.Serializable;
+
 /**
  * Routes the call to the local container, bypassing further client-side
  * interceptors and any remoting layer, if this interceptor was created 
@@ -53,6 +54,8 @@
 
    public static final String IS_LOCAL = "IS_LOCAL";
    public static final String IS_LOCAL_EXCEPTION = "IS_LOCAL_EXCEPTION";
+
+   private static boolean passByRef = Boolean.getBoolean(IsLocalInterceptor.class.getName() + ".passByRef");
    
    private static final long stamp = System.currentTimeMillis();
    private long marshalledStamp = stamp;
@@ -76,35 +79,41 @@
    
    protected Object invokeLocal(Invocation invocation, Container container) throws Throwable
    {
-      Invocation copy = (Invocation) new MarshalledObjectForLocalCalls(invocation).get();
+      Invocation copy = marshallOrPass(invocation, Invocation.class);
       copy.getMetaData().addMetaData(IS_LOCAL, IS_LOCAL, Boolean.TRUE, PayloadKey.AS_IS);
-      org.jboss.aop.joinpoint.InvocationResponse response = null;
-
-      // Invoke upon the container
-      SessionContainer sc = (SessionContainer) container;
-      response = sc.dynamicInvoke(copy);
-      
-      Map contextInfo = response.getContextInfo();
-      if (contextInfo != null)
+      try
       {
-         MarshalledObjectForLocalCalls wrappedException = (MarshalledObjectForLocalCalls) response.getContextInfo().get(IS_LOCAL_EXCEPTION);
-         if (wrappedException != null)
-         {
-            throw (Throwable) wrappedException.get();
-         }
+         // Invoke upon the container
+         SessionContainer sc = (SessionContainer) container;
+         InvocationResponse response = sc.dynamicInvoke(copy);
+         // it could really have been a copy
+         invocation.setResponseContextInfo(response.getContextInfo());
+         return marshallOrPass(response.getResponse(), Object.class);
       }
-      invocation.setResponseContextInfo(response.getContextInfo());
-      MarshalledObjectForLocalCalls wrapped = (MarshalledObjectForLocalCalls) response.getResponse();
-      Object rtn = null;
-      if (wrapped != null)
+      // TODO: Either Throwable (as it used to be) or Exception (which is better)
+      catch(Throwable t)
       {
-         rtn = wrapped.get();
+         throw marshallOrPass(t, Throwable.class);
       }
-      return rtn;
+      finally
+      {
+         copy.getMetaData().removeMetaData(IS_LOCAL, IS_LOCAL);
+      }
    }
 
    protected boolean isLocal()
    {
       return stamp == marshalledStamp;
    }
+
+   /**
+    * Marshall the obj or pass by ref, based on passByRef.
+    */
+   private static <T> T marshallOrPass(T obj, Class<T> type) throws IOException, ClassNotFoundException
+   {
+      if(passByRef)
+         return obj;
+      else
+         return type.cast(new MarshalledObjectForLocalCalls(obj).get());
+   }
 }
Index: src/main/java/org/jboss/ejb3/session/SessionContainer.java
===================================================================
--- src/main/java/org/jboss/ejb3/session/SessionContainer.java	(revision 106735)
+++ src/main/java/org/jboss/ejb3/session/SessionContainer.java	(working copy)
@@ -583,29 +583,13 @@
 
    public static InvocationResponse marshallException(Invocation invocation, Throwable exception, Map responseContext) throws Throwable
    {
-      if (invocation.getMetaData(IsLocalInterceptor.IS_LOCAL,IsLocalInterceptor.IS_LOCAL) == null) throw exception;
-
-      InvocationResponse response = new InvocationResponse();
-      response.setContextInfo(responseContext);
-
-      response.addAttachment(IsLocalInterceptor.IS_LOCAL_EXCEPTION, new MarshalledObjectForLocalCalls(exception));
-
-      return response;
+      throw exception;
    }
 
    public static InvocationResponse marshallResponse(Invocation invocation, Object rtn, Map responseContext)
            throws java.io.IOException
    {
-      InvocationResponse response;
-      // marshall return value
-      if (rtn != null && invocation.getMetaData(IsLocalInterceptor.IS_LOCAL, IsLocalInterceptor.IS_LOCAL) != null)
-      {
-         response = new InvocationResponse(new MarshalledObjectForLocalCalls(rtn));
-      }
-      else
-      {
-         response = new InvocationResponse(rtn);
-      }
+      InvocationResponse response = new InvocationResponse(rtn);
       response.setContextInfo(responseContext);
       return response;
    }
