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

        if not aName
          # arguments.callee is forbidden if strict mode enabled.
          try vCaller = arguments.callee.caller
          if vCaller
            while isInheritedFrom vCaller, Factory
              aName = vCaller
              vCaller = vCaller.caller
            aName = Factory.getNameFromClass(aName) if aName

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