         if not aName
           # arguments.callee is forbidden if strict mode enabled.
           try vCaller = arguments.callee.caller
-          if vCaller
-            while isInheritedFrom vCaller, Factory
+          if vCaller and isInheritedFrom vCaller, Factory
+            aName = vCaller
+            vCaller = vCaller.caller
+            #get farest hierarchical registered class
+            while isInheritedFrom vCaller, aName
               aName = vCaller
               vCaller = vCaller.caller
             aName = Factory.getNameFromClass(aName) if aName

  class CustomFactory
    constructor: (aName, aOptions)->
      if aName instanceof Factory
        aName.initialize aOptions if aOptions
        return aName
      if isObject aName
        aOptions = aName

            if result
              aParentClass[vName] = aClass
              Factory[vName] = aClass unless aParentClass is Factory
              if aOptions?
                registeredObjects[vName] = aOptions
              else
                registeredObjects[vName] = -1 #createObject aClass, aBufferSize
