      *  @playerversion AIR 1.1
      *  @productversion Flex 3
      */
-    public function remove(parent:UIComponent):void
+    override public function remove(parent:UIComponent):void
     {
         var obj:* = getOverrideContext(relativeTo, parent);
-        
+                
         if (!added || !(obj is DisplayObjectContainer))
+        {
+            if (obj == null)
+            {
+                // It seems our override is no longer active, but we were never
+                // able to successfully apply ourselves, so remove our context
+                // listener if applicable.
+                removeContextListener();
+                applied = false;
+                parentContext = null;
+            }
             return;
+        }
 
         switch (position)
         {

     *  @playerversion AIR 1.1
     *  @productversion Flex 3
     */
    public function apply(parent:UIComponent):void
    {
        var obj:* = relativeTo = getOverrideContext(relativeTo, parent);

        added = false;

        // Early exit if child is null or not a valid container.
        if (!target || !(obj is DisplayObjectContainer))
            return;

        // Can't reparent. Must remove before adding.
        if (target.parent)
        {

            }
        }

        // Clear our flags and override context.
        added = false;
        applied = false;
        parentContext = null;
    }
}

