          */
         protected function parentChanged(value:DesignLayer):void
         {
-            if (_parent)
+            // We remove our layer from the old parent unless the new
+            // parent is null (in this case we know we are invoking this 
+            // directly from removeLayer).
+            if (_parent && value)
                 _parent.removeLayer(this);
             
             _parent = value;

        protected function effectiveVisibilityChanged(value:Boolean):void
        {
            dispatchEvent(new PropertyChangeEvent("layerPropertyChange", false, 
                false, PropertyChangeEventKind.UPDATE, "effectiveVisibility", !value, value));
            
            for (var i:int = 0; i < layerChildren.length; i++)
            {

            {
                if (layerChildren[i] == value)
                {
                    value.parentChanged(null);
                    layerChildren.splice(i,1);
                    return;
                }
