diff --git a/src/main/java/net/floodlightcontroller/core/IOFSwitch.java b/src/main/java/net/floodlightcontroller/core/IOFSwitch.java
index b6188dcd63131bbeb44de0a3d452a83e41bdb27b..67345322dfeb7f1e4d3707cb007562ea4d36a47c 100644
--- a/src/main/java/net/floodlightcontroller/core/IOFSwitch.java
+++ b/src/main/java/net/floodlightcontroller/core/IOFSwitch.java
@@ -47,6 +47,7 @@ public interface IOFSwitch {
     public static final String PROP_REQUIRES_L3_MATCH = "requiresL3Match";
     public static final String PROP_SUPPORTS_OFPP_TABLE = "supportsOfppTable";
     public static final String PROP_SUPPORTS_OFPP_FLOOD = "supportsOfppFlood";
+    public static final String PROP_SUPPORTS_NETMASK_TBL = "supportsNetmaskTbl";
     
     /**
      * Writes to the OFMessage to the output stream.
diff --git a/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceIndex.java b/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceIndex.java
index f7831662d4e61442e82582818762547239b52551..0d8ea75dd42466600e9abf24637903750479985c 100644
--- a/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceIndex.java
+++ b/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceIndex.java
@@ -102,6 +102,15 @@ public abstract class DeviceIndex {
             IndexedEntity oio = new IndexedEntity(keyFields, o);
             if (oio.equals(ie)) return;
         }
-        removeEntity(entity, deviceKey);
+
+        Iterator<Long> keyiter = this.queryByEntity(entity);
+        while (keyiter.hasNext()) {
+                Long key = keyiter.next();
+                if (key.equals(deviceKey)) {
+                    removeEntity(entity, deviceKey);
+                    break;
+                }
+        }
     }
-}
\ No newline at end of file
+
+}
diff --git a/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImpl.java b/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImpl.java
index 56e04c827698b8231c677605e6ff0c7cb3b683f5..f55988f1be4ecb3956b26a6113c7693203e8e984 100755
--- a/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImpl.java
+++ b/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImpl.java
@@ -1257,7 +1257,14 @@ IFlowReconcileListener, IInfoProvider, IHAListener, IStorageSourceListener {
 
         if (deleteQueue != null) {
             for (Long l : deleteQueue) {
+                Device dev = deviceMap.get(l);
+                this.deleteDevice(dev);
                 deviceMap.remove(l);
+
+                // generate new device update
+                deviceUpdates =
+                        updateUpdates(deviceUpdates,
+                                      new DeviceUpdate(dev, DELETE, null));
             }
         }
 
diff --git a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java b/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java
index 22e1d2d0d4191a9afafde62ff9015bf35178f6b3..e528eafdc17820cdeb7ece1648cc35feeb14ccb3 100644
--- a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java
+++ b/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java
@@ -483,6 +483,7 @@ IFloodlightModule, IInfoProvider, IHAListener {
         // Send standard LLDPs
         for (long sw: switches) {
             IOFSwitch iofSwitch = floodlightProvider.getSwitches().get(sw);
+            if (iofSwitch == null) continue;
             if (iofSwitch.getEnabledPorts() != null) {
                 for (OFPhysicalPort p : iofSwitch.getEnabledPorts()) {
                     // sends only forward LLDPs and BDDPs
@@ -493,6 +494,7 @@ IFloodlightModule, IInfoProvider, IHAListener {
 
         for (long sw: switches) {
             IOFSwitch iofSwitch = floodlightProvider.getSwitches().get(sw);
+            if (iofSwitch == null) continue;
             if (iofSwitch.getEnabledPorts() != null) {
                 for (OFPhysicalPort p : iofSwitch.getEnabledPorts()) {
                     // sends only forward LLDPs and BDDPs