Index: /trunk/ORBit2-2.14.0/src/idl-compiler/orbit-idl-c-headers.c
===================================================================
--- /trunk/ORBit2-2.14.0/src/idl-compiler/orbit-idl-c-headers.c	(revision 254)
+++ /trunk/ORBit2-2.14.0/src/idl-compiler/orbit-idl-c-headers.c	(revision 255)
@@ -1321,15 +1321,25 @@
     doWriteParametersOnly(of, tree);
     fprintf(of, "ev) \\\n");
-    fprintf(of, "        (parmCheckFunc_%s(nomSelf, ", id);
-    /* Parameters for call */
-    doWriteParametersOnly(of, tree);
-
-    fprintf(of, "ev) ? \\\n");
-    fprintf(of, "        (NOM_Resolve(nomSelf, %s, %s) \\\n", id2, id3);
-    fprintf(of, "        (nomSelf,");
-    /* add the parms */
-    doWriteParametersOnly(of, tree);
-    fprintf(of, "ev)) : %s_retval)\n", id);
-
+    if(!strstr(id, "_nomIsObject"))
+      {
+        /* No check for _nomIsObject or otherwise we have a recursion */
+        fprintf(of, "        (parmCheckFunc_%s(nomSelf, ", id);
+        /* Parameters for call */
+        doWriteParametersOnly(of, tree);        
+        fprintf(of, "ev) ? \\\n");
+        fprintf(of, "        (NOM_Resolve(nomSelf, %s, %s) \\\n", id2, id3);
+        fprintf(of, "        (nomSelf,");
+        /* add the parms */
+        doWriteParametersOnly(of, tree);
+        fprintf(of, "ev)) : %s_retval)\n", id);
+      }
+    else
+      {
+        fprintf(of, "        (NOM_Resolve(nomSelf, %s, %s) \\\n", id2, id3);
+        fprintf(of, "        (nomSelf,");
+        /* add the parms */
+        doWriteParametersOnly(of, tree);
+        fprintf(of, "ev))\n");
+      }
     /* else NOM_NO_PARAM_CHECK */
     fprintf(of, "#else /* Extended parameter check */\n");
@@ -1340,13 +1350,28 @@
     doWriteParametersOnly(of, tree);
     fprintf(of, "ev) \\\n");
-    fprintf(of, "        (objectCheckFunc_%s(nomSelf, ", id2);
-    fprintf(of, " \"%s\") ? \\\n", id);
-    fprintf(of, "        (NOM_Resolve(nomSelf, %s, %s) \\\n", id2, id3);
-    fprintf(of, "        (nomSelf,");
-    /* add the parms */
-    doWriteParametersOnly(of, tree);
-    fprintf(of, "ev)) : (");
-    orbit_cbe_write_param_typespec(of, tree);
-    fprintf(of, ") NULL)\n");
+    if(!strstr(id, "_nomIsObject"))
+      {
+        /* No check for _nomIsObject or otherwise we have a recursion */
+        if(!strcmp(id2, "NOMObject"))
+          fprintf(of, "        (nomCheckNOMObjectPtr((NOMObject*)nomSelf, %sClassData.classObject,", id2);
+        else
+          fprintf(of, "        (nomCheckObjectPtr((NOMObject*)nomSelf, %sClassData.classObject,", id2);
+        fprintf(of, " \"%s\", ev) ? \\\n", id); /* method name */
+        fprintf(of, "        (NOM_Resolve(nomSelf, %s, %s) \\\n", id2, id3);
+        fprintf(of, "        (nomSelf,");
+        /* add the parms */
+        doWriteParametersOnly(of, tree);
+        fprintf(of, "ev)) : (");
+        orbit_cbe_write_param_typespec(of, tree);
+        fprintf(of, ") NULL)\n");
+      }
+    else
+      {
+        fprintf(of, "        (NOM_Resolve(nomSelf, %s, %s) \\\n", id2, id3);
+        fprintf(of, "        (nomSelf,");
+        /* add the parms */
+        doWriteParametersOnly(of, tree);
+        fprintf(of, "ev))\n");
+      }
     fprintf(of, "#endif\n");
 
@@ -1480,6 +1505,8 @@
       /******* Print generic object check function  *******/
 
-      fprintf(ci->fh, "NOMEXTERN gboolean NOMLINK objectCheckFunc_%s(%s *nomSelf, gchar* chrMethodName);\n\n", id, id);
-
+      if(!strcmp(id, "NOMObject"))
+        fprintf(ci->fh, "NOMEXTERN gboolean NOMLINK nomCheckNOMObjectPtr(NOMObject *nomSelf, NOMClass* nomClass, gchar* chrMethodName, CORBA_Environment *ev);\n\n");
+      else
+        fprintf(ci->fh, "NOMEXTERN gboolean NOMLINK nomCheckObjectPtr(NOMObject *nomSelf, NOMClass* nomClass, gchar* chrMethodName, CORBA_Environment *ev);\n\n");
       
       /******* Print introduced methods *******/
Index: /trunk/ORBit2-2.14.0/src/idl-compiler/orbit-idl-c-skelimpl.c
===================================================================
--- /trunk/ORBit2-2.14.0/src/idl-compiler/orbit-idl-c-skelimpl.c	(revision 254)
+++ /trunk/ORBit2-2.14.0/src/idl-compiler/orbit-idl-c-skelimpl.c	(revision 255)
@@ -460,5 +460,5 @@
          check the object pointer. */
       fprintf(ski->of, "\n/* Function to check if an object is valid before calling a method on it */\n");
-      fprintf(ski->of, "#ifndef NOM_NO_PARAM_CHECK\n");
+      fprintf(ski->of, "#ifdef NOM_NO_PARAM_CHECK /* Disabled by now because not working */\n");
       fprintf(ski->of, "NOMEXTERN ");                
       fprintf(ski->of, "gboolean NOMLINK objectCheckFunc_%s(%s *nomSelf, gchar* chrMethodName)\n",
@@ -466,5 +466,5 @@
       fprintf(ski->of, "{\n");
       
-      fprintf(ski->of, "if(!nomIsObj(nomSelf) || !_nomIsA(nomSelf , %sClassData.classObject, NULLHANDLE))\n", id2);
+      fprintf(ski->of, "if(!nomIsObj(nomSelf) || !_nomIsANoClsCheck(nomSelf , %sClassData.classObject, NULLHANDLE))\n", id2);
       fprintf(ski->of, "  {\n");
       fprintf(ski->of, "  nomPrintObjectPointerError(nomSelf, \"%s\", chrMethodName);\n", id2);
@@ -1134,5 +1134,5 @@
                 fprintf(ski->of, "{\n");
 
-                fprintf(ski->of, "if(!nomIsObj(nomSelf) || !_nomIsA(nomSelf , %sClassData.classObject, NULLHANDLE))\n", id2);
+                fprintf(ski->of, "if(!nomIsObj(nomSelf) || !_nomIsANoClsCheck(nomSelf , %sClassData.classObject, NULLHANDLE))\n", id2);
                 fprintf(ski->of, "  {\n");
                 fprintf(ski->of, "  nomPrintObjectPointerError(nomSelf, \"%s\", \"%s\");\n", id2, id);
Index: /trunk/nom/class_c/nomclassmanager.c
===================================================================
--- /trunk/nom/class_c/nomclassmanager.c	(revision 254)
+++ /trunk/nom/class_c/nomclassmanager.c	(revision 255)
@@ -302,4 +302,5 @@
   NOMClassMgrData* nomThis=NOMClassMgrGetData(nomSelf);
 
+  g_message("In %s", __FUNCTION__);
   NOMClassMgr_nomInit_parent((NOMObject*)nomSelf,  ev);
 
Index: /trunk/nom/class_c/nomcls.c
===================================================================
--- /trunk/nom/class_c/nomcls.c	(revision 254)
+++ /trunk/nom/class_c/nomcls.c	(revision 255)
@@ -79,7 +79,4 @@
   gchar* nObj;
 
-  if(!nomSelf)
-    return NULLHANDLE;
-
   if(!_ncpObject)
     return NULLHANDLE;
@@ -134,9 +131,15 @@
                                                     CORBA_Environment *ev)
 {
+#if 0
+  CORBA_Environment tempEnv={0};
+  tempEnv.fFlags=NOMENV_FLG_DONT_CHECK_OBJECT;
+#endif
   _nomRenewNoInit(nomSelf, nomObj, NULLHANDLE);
 
   /* And now give the object the possibility to initialize... */
+  /* Make sure the object is not checked. */
+  //_nomInit((NOMObject*)nomObj, &tempEnv);
   _nomInit((NOMObject*)nomObj, NULLHANDLE);
-  
+
   return nomObj;
 }
@@ -210,4 +213,6 @@
 NOM_Scope void NOMLINK impl_NOMClass_nomClassReady(NOMClass* nomSelf, CORBA_Environment *ev)
 {
+  CORBA_Environment tempEnv={0};
+  tempEnv.fFlags=NOMENV_FLG_DONT_CHECK_OBJECT;
 
   nomPrintf("    Entering %s  with nomSelf: 0x%x. nomSelf is: %s.\n",
@@ -231,6 +236,6 @@
       //if(!_nomFindClassFromName(NOMClassMgrObject, _nomGetName(nomSelf, NULLHANDLE),
       //                        0, 0, NULLHANDLE))
-      if(!_nomFindClassFromName(NOMClassMgrObject, _nomGetClassName(nomSelf, NULLHANDLE),
-                              0, 0, NULLHANDLE))
+      if(!_nomFindClassFromName(NOMClassMgrObject, _nomGetClassName(nomSelf, &tempEnv),
+                              0, 0, &tempEnv))
 
         {
@@ -305,9 +310,17 @@
 {
 /* NOMClassData* nomThis=NOMClassGetData(nomSelf); */
-
-  //nomPrintf("    Entering %s  with nomSelf: 0x%x. nomSelf is: %s.\n",
-  //           __FUNCTION__, nomSelf, nomSelf->mtab->nomClassName);
-
-  NOMClass_nomInit_parent(nomSelf,  ev);
-}
-
+#if 0
+  CORBA_Environment tempEnv={0};
+  tempEnv.fFlags=NOMENV_FLG_DONT_CHECK_OBJECT;
+#endif
+  //  nomPrintf("    Entering %s  with nomSelf: 0x%x. nomSelf is: %s.\n",
+  //         __FUNCTION__, nomSelf, nomSelf->mtab->nomClassName);
+
+  /* Don't check object pointer. We are just created but not yet registered as a class. */
+  //  NOMClass_nomInit_parent(nomSelf,  &tempEnv);
+  NOMClass_nomInit_parent(nomSelf, NULLHANDLE);
+}
+
+
+
+
Index: /trunk/nom/class_c/nomobj.c
===================================================================
--- /trunk/nom/class_c/nomobj.c	(revision 254)
+++ /trunk/nom/class_c/nomobj.c	(revision 255)
@@ -164,6 +164,4 @@
 {
   /* NOMObjectData* nomThis=NOMObjectGetData(nomSelf); */
-  NOMClassPriv* ncp;
-  nomMethodTabs mtabs; /* List of mtabs */
 
   if(!nomIsObj(nomClass)){
@@ -171,4 +169,15 @@
     return FALSE;
   }
+
+  return _nomIsANoClsCheck(nomSelf, nomClass, ev);
+}
+
+
+NOM_Scope CORBA_boolean NOMLINK impl_NOMObject_nomIsANoClsCheck(NOMObject* nomSelf, const PNOMClass nomClass,
+                                                                CORBA_Environment *ev)
+{
+  /* NOMObjectData* nomThis=NOMObjectGetData(nomSelf); */
+  NOMClassPriv* ncp;
+  nomMethodTabs mtabs; /* List of mtabs */
 
   /* Check if we have the class in our list of classes */
@@ -185,5 +194,4 @@
 }
 
-
 NOM_Scope CORBA_boolean NOMLINK impl_NOMObject_nomIsInstanceOf(NOMObject* nomSelf, const PNOMClass nomClass, CORBA_Environment *ev)
 {
Index: /trunk/nom/exports.def
===================================================================
--- /trunk/nom/exports.def	(revision 254)
+++ /trunk/nom/exports.def	(revision 255)
@@ -19,4 +19,8 @@
 	nomRegisterDLLByName
 	nomQueryUsingNameIsDLLRegistered
+;        nomPrintObjectPointerErrorMsg
+	nomCheckNOMObjectPtr
+	nomCheckObjectPtr
+	nomCreateEnvNoObjectCheck
 
 	nomPrintf		
Index: /trunk/nom/idl/nomobj.idl
===================================================================
--- /trunk/nom/idl/nomobj.idl	(revision 254)
+++ /trunk/nom/idl/nomobj.idl	(revision 255)
@@ -175,5 +175,5 @@
      subclasses.
 
-     \sa nomIsInstanceOf()
+     \sa nomIsInstanceOf(), nomIsANoClsCheck()
    */
   boolean nomIsA(in PNOMClass nomClass);
@@ -190,5 +190,5 @@
      \returns TRUE if the object is an instance of exactly the given class.
 
-     \sa nomIsA()
+     \sa nomIsA(), nomIsANoClsCheck()
    */
   boolean nomIsInstanceOf(in PNOMClass nomClass);
@@ -206,6 +206,24 @@
   string nomGetClassName();
 
+  /**
+     This method checks if the object is an instance of the given class or some subclass. Using
+     this method one can make sure some feature is available if the introducing class is known.
+     Every subclass of a given class also supports the features of the introducing class. 
+
+     \remarks This method does \e not check the validity of \e nomClass using nomIsObj(). So
+     make sure to have checked it beforehand. You may want to use nomIsA() instead;
+
+     \param nomClass Pointer to a class object.
+
+     \returns TRUE if the object is an instance of the given class or one of its
+     subclasses.
+
+     \sa nomIsInstanceOf(), nomIsA()
+   */
+  boolean nomIsANoClsCheck(in PNOMClass nomClass);
 
 };
 
 #endif /* NOMOBJ_IDL_INCLUDED */
+
+
Index: /trunk/nom/include/nom.h
===================================================================
--- /trunk/nom/include/nom.h	(revision 254)
+++ /trunk/nom/include/nom.h	(revision 255)
@@ -161,5 +161,5 @@
 
 /* The following is probably not correct... */
-typedef NOMAnyObj CORBA_Environment;
+//typedef NOMAnyObj CORBA_Environment;
 
 #define nomresolve_(obj,mToken) ((nomMethodProc*)((void)obj, mToken))
Index: /trunk/nom/include/nomapi.h
===================================================================
--- /trunk/nom/include/nomapi.h	(revision 254)
+++ /trunk/nom/include/nomapi.h	(revision 255)
@@ -181,4 +181,16 @@
 } nomClassList, *nomClasses;
 
+
+#define NOMENV_FLG_DONT_CHECK_OBJECT  0x00000001
+
+typedef struct
+{
+  gulong fFlags;
+  gpointer pReserved1;
+  gpointer pReserved2;  
+}nomEnvironment;
+
+typedef nomEnvironment CORBA_Environment;
+
 NOMEXTERN NOMClass * NOMLINK nomBuildClass (gulong ulReserved,
                                             nomStaticClassInfo *sci,
@@ -186,5 +198,4 @@
                                             gulong ulMinorVersion);
 
-//#define nomIsObj(a) ((a)!= 0)
 #endif /* NOMAPI_H_INCLUDED */
 
Index: /trunk/nom/include/nomtk.h
===================================================================
--- /trunk/nom/include/nomtk.h	(revision 254)
+++ /trunk/nom/include/nomtk.h	(revision 255)
@@ -16,5 +16,5 @@
 * The Initial Developer of the Original Code is
 * netlabs.org: Chris Wohlgemuth <cinc-ml@netlabs.org>.
-* Portions created by the Initial Developer are Copyright (C) 2005-2006
+* Portions created by the Initial Developer are Copyright (C) 2005-2007
 * the Initial Developer. All Rights Reserved.
 *
@@ -75,4 +75,7 @@
 NOMEXTERN nomId NOMLINK nomIdFromString(gchar* inString);
 NOMEXTERN gchar* NOMLINK nomStringFromId(nomId inId);
+NOMEXTERN void NOMLINK nomPrintObjectPointerError(NOMObject*  nomObject, gchar *chrClsName, gchar* chrMethodName);
+NOMEXTERN gboolean NOMLINK nomCheckObjectPtr(NOMObject *nomSelf, NOMClass* nomClass, gchar* chrMethodName, CORBA_Environment *ev);
+NOMEXTERN CORBA_Environment* NOMLINK nomCreateEnvNoObjectCheck(void);
 
 /* Functions used by nomBuildClass() */
Index: /trunk/nom/src/nombuildclass.c
===================================================================
--- /trunk/nom/src/nombuildclass.c	(revision 254)
+++ /trunk/nom/src/nombuildclass.c	(revision 255)
@@ -16,5 +16,5 @@
 * The Initial Developer of the Original Code is
 * netlabs.org: Chris Wohlgemuth <cinc-ml@netlabs.org>.
-* Portions created by the Initial Developer are Copyright (C) 2005-2006
+* Portions created by the Initial Developer are Copyright (C) 2005-2007
 * the Initial Developer. All Rights Reserved.
 *
@@ -969,4 +969,6 @@
                                                   ulMajorVersion, ulMinorVersion);
         if(nomClass){
+          CORBA_Environment * tempEnv=nomCreateEnvNoObjectCheck();
+
           DBG_NOMBUILDCLASS(TRUE, "%s: class is 0x%x\n", nomClass->mtab->nomClassName, nomClass);
 #if 0
@@ -977,6 +979,8 @@
           priv_checkForNomUnInitOverride( (NOMClassPriv*)nomClass->mtab->nomClsInfo,  ncpParent);
 #endif     
-          _nomInit((NOMObject*)nomClass, NULLHANDLE);
-          _nomClassReady(nomClass, NULLHANDLE);
+          /* Make sure the env is marked that we don't chek the object pointer. This would fail
+             because the class isn't registered yet. */
+          _nomInit((NOMObject*)nomClass, tempEnv);
+          _nomClassReady(nomClass, tempEnv);
         }
 
@@ -993,6 +997,9 @@
 
       if(nomClass){
-        _nomInit((NOMObject*)nomClass, NULLHANDLE);
-        _nomClassReady(nomClass, NULLHANDLE);
+        CORBA_Environment * tempEnv=nomCreateEnvNoObjectCheck();
+        /* Make sure the env is marked that we don't chek the object pointer. This would fail
+           because the class isn't registered yet. */
+        _nomInit((NOMObject*)nomClass, tempEnv);
+        _nomClassReady(nomClass, tempEnv);
       }
       return nomClass;
@@ -1088,4 +1095,6 @@
 
   if(nomClass){
+    CORBA_Environment * tempEnv=nomCreateEnvNoObjectCheck();
+
     /* Mark the class as using nomUnInit() if any parent did that. We just have to
        check the flag and the flag of the parent class. This information is important
@@ -1094,6 +1103,8 @@
     priv_checkForNomUnInitOverride( (NOMClassPriv*)nomClass->mtab->nomClsInfo,  ncpParent);
     
-    _nomInit(nomClass, NULLHANDLE);
-    _nomClassReady(nomClass, NULLHANDLE);
+    /* Make sure the env is marked that we don't chek the object pointer. This would fail
+       because the class isn't registered yet. */
+    _nomInit(nomClass, tempEnv);
+    _nomClassReady(nomClass, tempEnv);
   }
   return nomClass;
Index: /trunk/nom/src/nombuildnomcls.c
===================================================================
--- /trunk/nom/src/nombuildnomcls.c	(revision 254)
+++ /trunk/nom/src/nombuildnomcls.c	(revision 255)
@@ -16,5 +16,5 @@
 * The Initial Developer of the Original Code is
 * netlabs.org: Chris Wohlgemuth <cinc-ml@netlabs.org>.
-* Portions created by the Initial Developer are Copyright (C) 2005-2006
+* Portions created by the Initial Developer are Copyright (C) 2005-2007
 * the Initial Developer. All Rights Reserved.
 *
Index: /trunk/nom/src/nombuildnomobj.c
===================================================================
--- /trunk/nom/src/nombuildnomobj.c	(revision 254)
+++ /trunk/nom/src/nombuildnomobj.c	(revision 255)
@@ -16,5 +16,5 @@
 * The Initial Developer of the Original Code is
 * netlabs.org: Chris Wohlgemuth <cinc-ml@netlabs.org>.
-* Portions created by the Initial Developer are Copyright (C) 2005-2006
+* Portions created by the Initial Developer are Copyright (C) 2005-2007
 * the Initial Developer. All Rights Reserved.
 *
Index: /trunk/nom/src/nomdebug.c
===================================================================
--- /trunk/nom/src/nomdebug.c	(revision 254)
+++ /trunk/nom/src/nomdebug.c	(revision 255)
@@ -16,5 +16,5 @@
 * The Initial Developer of the Original Code is
 * netlabs.org: Chris Wohlgemuth <cinc-ml@netlabs.org>.
-* Portions created by the Initial Developer are Copyright (C) 2005-2006
+* Portions created by the Initial Developer are Copyright (C) 2005-2007
 * the Initial Developer. All Rights Reserved.
 *
@@ -55,5 +55,82 @@
 //#include "cwsomcls.h"
 extern NOMClassMgr* NOMClassMgrObject;
-
+extern gboolean fInitialized;
+
+NOMEXTERN void NOMLINK nomPrintObjectPointerErrorMsg(NOMObject*  nomObject, gchar *chrClsName, gchar* chrMethodName)
+{
+  if(!nomObject)
+    g_warning("The object used to call the method %s is not valid. A NULL pointer was given.", chrMethodName);
+  else{
+    if(!nomIsObj(nomObject))
+      g_warning("The object used to call the method %s is not a valid NOM object. ", chrMethodName);
+    else
+      g_warning("The object used to call the method %s is not valid for this method. The object must be some instance of class %s (or of a subclass) but is a %s.", chrMethodName, chrClsName, NOMObject_nomGetClassName(nomObject, NULLHANDLE));
+  }
+}
+
+/*
+  This function prints some more info about the object error. It's used for generic checks which
+  always return NULL which isn't always correct.
+ */
+static void nomPrintAdditionalErrorMsg(void)
+{
+  g_message("Note that NULL is returned for the call (if the method returns a value). This may not be correct. Use the NOMPARMCHECK() macro to specify default return values for methods.");
+}
+
+/* Function to check if  NOMObject is valid before calling a method on it. Note that we don't have to check
+   the instance class here using nomIsA*(). */
+NOMEXTERN gboolean NOMLINK nomCheckNOMObjectPtr(NOMObject *nomSelf, NOMClass* nomClass, gchar* chrMethodName, CORBA_Environment *ev)
+{
+  /* Not initialized yet, so object check won't work. This means the three core NOM classes are not
+     yet created.*/
+  if(!fInitialized)
+    return TRUE;
+  
+  if(ev && (ev->fFlags & NOMENV_FLG_DONT_CHECK_OBJECT))
+    return TRUE;
+
+  //  g_message("In %s with %s %px nomClass: %px (%s)", __FUNCTION__, chrMethodName, nomSelf, nomClass, nomClass->mtab->nomClassName);
+  if(!nomIsObj(nomSelf))
+    {
+      nomPrintObjectPointerErrorMsg(nomSelf, nomClass->mtab->nomClassName, chrMethodName);
+      nomPrintAdditionalErrorMsg();
+      return FALSE;
+    }
+  return TRUE;
+}
+
+#include <string.h>
+/* Function to check if an object is valid before calling a method on it */
+NOMEXTERN gboolean NOMLINK nomCheckObjectPtr(NOMObject *nomSelf, NOMClass* nomClass, gchar* chrMethodName, CORBA_Environment *ev)
+{
+  /* Not initialized yet, so object check won't work. This means the three core NOM classes are not
+     yet created.*/
+  if(!fInitialized)
+    return TRUE;
+
+  //if(strstr( chrMethodName, "nomIsObj"))
+  //return TRUE;
+
+  if(ev && (ev->fFlags & NOMENV_FLG_DONT_CHECK_OBJECT))
+    return TRUE;
+
+  //  g_message("In %s with %s %px nomClass: %px (%s)", __FUNCTION__, chrMethodName, nomSelf, nomClass, nomClass->mtab->nomClassName);
+  if(!nomIsObj(nomSelf) || !_nomIsANoClsCheck(nomSelf, nomClass, NULLHANDLE))
+    {
+      nomPrintObjectPointerErrorMsg(nomSelf, nomClass->mtab->nomClassName, chrMethodName);
+      nomPrintAdditionalErrorMsg();
+      return FALSE;
+    }
+  return TRUE;
+}
+
+NOMEXTERN CORBA_Environment* NOMLINK nomCreateEnvNoObjectCheck(void)
+{
+  CORBA_Environment * tempEnv=(CORBA_Environment*)NOMMalloc(sizeof(CORBA_Environment));
+  if(tempEnv)
+    tempEnv->fFlags|=NOMENV_FLG_DONT_CHECK_OBJECT;
+  return tempEnv;
+}
+ 
 static void dumpClassFunc(GQuark gquark, gpointer data, gpointer user_data)
 {
Index: /trunk/nom/src/nomtkinit.c
===================================================================
--- /trunk/nom/src/nomtkinit.c	(revision 254)
+++ /trunk/nom/src/nomtkinit.c	(revision 255)
@@ -61,4 +61,6 @@
 NOMClassMgr* NOMClassMgrObject=NULLHANDLE; /* Referenced from different files */
 
+gboolean fInitialized=FALSE;
+
 /********************************************************/
 /*   Toolkit functions, exported                        */
@@ -131,4 +133,5 @@
   NOMClassPriv* ncPriv;
   NOMClass* nomCls;
+  //  NOMClassMgr *NOMClassMgrObject_priv;
 #if 0
   NOMObject *nomObj;
@@ -162,5 +165,5 @@
 
 #ifdef DEBUG_NOMENVNEW
-  nomPrintf("%s: NOMClassMgrObject: %x \n", __FUNCTION__, NOMClassMgrObject);
+  nomPrintf("%s: NOMClassMgrObject: %x (%x)\n", __FUNCTION__, NOMClassMgrObject, pGlobalNomEnv->defaultMetaClass);
 #endif
 
@@ -196,4 +199,8 @@
   _nomTestFunc_NOMTest2(nomTst2Obj, NULLHANDLE);
 #endif
+  /* This must be done last! */
+  //  NOMClassMgrObject=NOMClassMgrObject_priv;
+
+  fInitialized=TRUE;
 
   return NOMClassMgrObject;
