             // test to see if parent is a Bootstrap
             if (parent && !parent.dispatchEvent(new Event("mx.managers.SystemManager.isBootstrapRoot", false, true)))
                 return this;
-  			var lastParent:DisplayObject = parent;
+  			var lastParent:DisplayObject = this;
 			while (parent)
 			{
 				if (parent is Stage)

		if (!topLevel && topLevelSystemManager)
			return topLevelSystemManager.useSWFBridge();
			
		// if we're toplevel and we aren't the sandbox root, we need a bridge
		if (topLevel && getSandboxRoot() != this)
			return true;
		
		// we also need a bridge even if we're the sandbox root
		// but not a stage root, but our parent loader is a bootstrap
		// that is not the stage root
		if (getSandboxRoot() == this)
		{
			try
			{

				    if (!loaderInfo.childAllowsParent)
				        return loaderInfo.content;
				}
                
                // If an object is listening for system manager request we assume it is a sandbox
                // root. If not, don't assign lastParent to this parent because it may be a
                // non-Flex application. We only want Flex apps to be returned as sandbox roots.
                if (parent.hasEventListener(InterManagerRequest.SYSTEM_MANAGER_REQUEST))
    				lastParent = parent; 
				parent = parent.parent;				
			}
		}
        catch (error:Error)
        {
            // Either we don't have security access to a parent or
            // the swf is unloaded and loaderInfo.childAllowsParent is throwing Error #2099.
        }       
		
		return lastParent != null ? lastParent : DisplayObject(sm);
	}
