diff --git a/src/main/java/net/floodlightcontroller/devicemanager/internal/Device.java b/src/main/java/net/floodlightcontroller/devicemanager/internal/Device.java
index 18afaee399dd582a2780777e22e83b3931cdf71a..dc7c0da7bf897cccbfc6e09a21762a3fddc25358 100755
--- a/src/main/java/net/floodlightcontroller/devicemanager/internal/Device.java
+++ b/src/main/java/net/floodlightcontroller/devicemanager/internal/Device.java
@@ -311,7 +311,7 @@ public class Device implements IDevice {
             }
 
             prev = clentities[clEntIndex] = cur;
-            prevCluster = curCluster;
+            prevCluster = topology.getL2DomainId(prev.getSwitchDPID());
 
             long prevLastSeen =
                     deviceManager.apComparator.
diff --git a/src/main/java/org/openflow/protocol/OFMatch.java b/src/main/java/org/openflow/protocol/OFMatch.java
index 5cf0454f4032371c0d1c23ad6bb3decfb8e184e7..def0bfa7c791da9e47d1d816a33708f1d494f356 100644
--- a/src/main/java/org/openflow/protocol/OFMatch.java
+++ b/src/main/java/org/openflow/protocol/OFMatch.java
@@ -365,22 +365,27 @@ public class OFMatch implements Cloneable, Serializable {
 
     /**
      * Get nw_tos
+     * OFMatch stores the ToS bits as top 6-bits, so right shift by 2 bits
+     * before returning the value
      * 
-     * @return
+     * @return : 6-bit DSCP value (0-63)
      */
     public byte getNetworkTypeOfService() {
-        return this.networkTypeOfService;
+        return (byte) (this.networkTypeOfService >> 2);
     }
 
     /**
      * Set nw_tos
+     * OFMatch stores the ToS bits as top 6-bits, so left shift by 2 bits
+     * before storing the value
      * 
-     * @param networkTypeOfService
+     * @param networkTypeOfService : 6-bit DSCP value (0-63)
      */
     public OFMatch setNetworkTypeOfService(byte networkTypeOfService) {
-        this.networkTypeOfService = networkTypeOfService;
+        this.networkTypeOfService = (byte)(networkTypeOfService << 2);
         return this;
     }
+    
 
     /**
      * Get tp_dst
@@ -760,7 +765,7 @@ public class OFMatch implements Cloneable, Serializable {
         if ((wildcards & OFPFW_NW_PROTO) == 0)
             str += "," + STR_NW_PROTO + "=" + this.networkProtocol;
         if ((wildcards & OFPFW_NW_TOS) == 0)
-            str += "," + STR_NW_TOS + "=" + this.networkTypeOfService;
+            str += "," + STR_NW_TOS + "=" + this.getNetworkTypeOfService();
 
         // l4
         if ((wildcards & OFPFW_TP_DST) == 0)
@@ -881,7 +886,7 @@ public class OFMatch implements Cloneable, Serializable {
                 this.networkProtocol = U8.t(Short.valueOf(values[1]));
                 this.wildcards &= ~OFPFW_NW_PROTO;
             } else if (values[0].equals(STR_NW_TOS)) {
-                this.networkTypeOfService = U8.t(Short.valueOf(values[1]));
+                this.setNetworkTypeOfService(U8.t(Short.valueOf(values[1])));
                 this.wildcards &= ~OFPFW_NW_TOS;
             } else if (values[0].equals(STR_TP_DST)) {
                 this.transportDestination = U16.t(Integer.valueOf(values[1]));