Index: src/pycorba-object.c
===================================================================
--- src/pycorba-object.c	(revision 149)
+++ src/pycorba-object.c	(working copy)
@@ -65,7 +65,7 @@
     CORBA_exception_init(&ev);
     repo_id = ORBit_small_get_type_id(self->objref, &ev);
     if (ev._major != CORBA_NO_EXCEPTION)
-	repo_id = NULL;
+        repo_id = NULL;
     CORBA_exception_free(&ev);
 
     ret = PyString_FromFormat("<CORBA.Object '%s' at %p>",
@@ -117,7 +117,7 @@
 pycorba_object__duplicate(PyCORBA_Object *self)
 {
     /* pycorba_object_new() duplicates the objref ... */
-    return pycorba_object_new(self->objref);
+    return pycorba_object_new(self->objref, NULL);
 }
 
 static PyObject *
@@ -317,7 +317,7 @@
 };
 
 PyObject *
-pycorba_object_new(CORBA_Object objref)
+pycorba_object_new(CORBA_Object objref, CORBA_TypeCode tc)
 {
     PyTypeObject *stub = NULL;
     PyCORBA_Object *self;
@@ -327,7 +327,12 @@
 	Py_INCREF(Py_None);
 	return Py_None;
     }
+    // get stub for ORBit object
     stub = (PyTypeObject *)pyorbit_get_stub_from_objref(objref);
+    if (!stub && tc != NULL) {
+        // get stub from typecode
+        stub = (PyTypeObject *)pyorbit_get_stub(tc);
+    }
     if (!stub) stub = &PyCORBA_Object_Type; /* fall back */
 
     args = PyTuple_New(0);
Index: src/pyorbit-poa.c
===================================================================
--- src/pyorbit-poa.c	(revision 149)
+++ src/pyorbit-poa.c	(working copy)
@@ -260,7 +260,7 @@
     if (pyorbit_check_ex(&ev))
 	return NULL;
 
-    py_reference = pycorba_object_new(reference);
+    py_reference = pycorba_object_new(reference, NULL);
     CORBA_Object_release(reference, NULL);
     return py_reference;
 }
Index: src/pyorbit-private.h
===================================================================
--- src/pyorbit-private.h	(revision 149)
+++ src/pyorbit-private.h	(working copy)
@@ -42,7 +42,7 @@
 extern PyTypeObject PyCORBA_TypeCode_Type;
 extern PyTypeObject PyCORBA_Any_Type;
 
-PyObject *pycorba_object_new(CORBA_Object objref);
+PyObject *pycorba_object_new(CORBA_Object objref, CORBA_TypeCode tc);
 PyObject *pycorba_orb_new(CORBA_ORB orb);
 PyObject *pycorba_typecode_new(CORBA_TypeCode tc);
 PyObject *pycorba_any_new(CORBA_any *any);
Index: src/pyorbit-servant.c
===================================================================
--- src/pyorbit-servant.c	(revision 149)
+++ src/pyorbit-servant.c	(working copy)
@@ -532,7 +532,7 @@
     if (pyorbit_check_ex(&ev))
     	return NULL;
 
-    self->this = pycorba_object_new(objref);
+    self->this = pycorba_object_new(objref, NULL);
     CORBA_Object_release(objref, NULL);
     Py_INCREF(self->this);
     return self->this;
Index: src/pycorba-orb.c
===================================================================
--- src/pycorba-orb.c	(revision 149)
+++ src/pycorba-orb.c	(working copy)
@@ -76,7 +76,7 @@
     objref = CORBA_ORB_string_to_object(self->orb, ior, &ev);
     if (pyorbit_check_ex(&ev))
 	return NULL;
-    py_objref = pycorba_object_new(objref);
+    py_objref = pycorba_object_new(objref, NULL);
     CORBA_Object_release(objref, NULL);
     return py_objref;
 }
@@ -123,7 +123,7 @@
     if (!strcmp(identifier, "RootPOA")) {
 	return pyorbit_poa_new((PortableServer_POA)objref);
     }
-    py_objref = pycorba_object_new(objref);
+    py_objref = pycorba_object_new(objref, NULL);
     CORBA_Object_release(objref, NULL);
     return py_objref;
 }
Index: src/pycorba-marshal.c
===================================================================
--- src/pycorba-marshal.c	(revision 149)
+++ src/pycorba-marshal.c	(working copy)
@@ -448,7 +448,7 @@
 	break;
     case CORBA_tk_objref:
 	alignval(val, ORBIT_ALIGNOF_CORBA_POINTER);
-	ret = pycorba_object_new(getval(val, CORBA_Object));
+	ret = pycorba_object_new(getval(val, CORBA_Object), tc);
 	advanceptr(val, sizeof(CORBA_Object));
 	break;
     case CORBA_tk_struct:
