Index: lib/OpenLayers/Control/SelectFeature.js
===================================================================
--- lib/OpenLayers/Control/SelectFeature.js	(revision 9145)
+++ lib/OpenLayers/Control/SelectFeature.js	(working copy)
@@ -225,8 +225,6 @@
             if(this.handlers.box) {
                 this.handlers.box.deactivate();
             }
-            this.map.events.unregister("changelayer", this.layer,
-                this.layer.handleChangeLayer);
             this.map.removeLayer(this.layer);
         }
         return OpenLayers.Control.prototype.deactivate.apply(
Index: lib/OpenLayers/Renderer.js
===================================================================
--- lib/OpenLayers/Renderer.js	(revision 9145)
+++ lib/OpenLayers/Renderer.js	(working copy)
@@ -256,18 +256,16 @@
     moveRoot: function(renderer) {},
 
     /**
-     * Method: getRenderLayer
+     * Method: getRenderLayerId
      * Gets the layer that this renderer's output appears on. If moveRoot was
-     * used, this will be different from the layer containing the features
-     * rendered by this renderer.
-     * To be overridden by subclasses that implement moveRoot.
+     * used, this will be different from the id of the layer containing the
+     * features rendered by this renderer.
      * 
      * Returns:
-     * {<OpenLayers.Layer.Vector>} the output layer, if any (i.e. this method
-     * will not return a layer if the layer is not added to a map).
+     * {String} the id of the output layer.
      */
-    getRenderLayer: function() {
-        return this.map.getLayer(this.container.id);
+    getRenderLayerId: function() {
+        return this.container.id;
     },
 
     CLASS_NAME: "OpenLayers.Renderer"
Index: lib/OpenLayers/Renderer/Elements.js
===================================================================
--- lib/OpenLayers/Renderer/Elements.js	(revision 9145)
+++ lib/OpenLayers/Renderer/Elements.js	(working copy)
@@ -898,17 +898,16 @@
     },
     
     /**
-     * Method: getRenderLayer
+     * Method: getRenderLayerId
      * Gets the layer that this renderer's output appears on. If moveRoot was
-     * used, this will be different from the layer containing the features
-     * rendered by this renderer.
+     * used, this will be different from the id of the layer containing the
+     * features rendered by this renderer.
      * 
      * Returns:
-     * {<OpenLayers.Layer.Vector>} the output layer, if any (i.e. this method
-     * will not return a layer if it is not added to a map).
+     * {String} the id of the output layer.
      */
-    getRenderLayer: function() {
-        return this.map.getLayer(this.root.parentNode.parentNode.id);
+    getRenderLayerId: function() {
+        return this.root.parentNode.parentNode.id;
     },
     
     /**
Index: lib/OpenLayers/Layer/Vector/RootContainer.js
===================================================================
--- lib/OpenLayers/Layer/Vector/RootContainer.js	(revision 9145)
+++ lib/OpenLayers/Layer/Vector/RootContainer.js	(working copy)
@@ -127,7 +127,7 @@
         var layer;
         for(var i=0; i<this.layers.length; ++i) {
             layer = this.layers[i];
-            if(layer.renderer.getRenderLayer() == this) {
+            if(this.renderer && layer.renderer.getRenderLayerId() == this.id) {
                 this.renderer.moveRoot(layer.renderer);
             }
         }
