diff --git a/apps/bgprouter/src/main/java/org/onosproject/bgprouter/BgpRouter.java b/apps/bgprouter/src/main/java/org/onosproject/bgprouter/BgpRouter.java
index 66e4b25..f151bc3 100644
--- a/apps/bgprouter/src/main/java/org/onosproject/bgprouter/BgpRouter.java
+++ b/apps/bgprouter/src/main/java/org/onosproject/bgprouter/BgpRouter.java
@@ -211,18 +211,7 @@
     }
 
     private void installFlow(FibEntry entry, Group group) {
-        TrafficSelector selector = DefaultTrafficSelector.builder()
-                .matchEthType(Ethernet.TYPE_IPV4)
-                .matchIPDst(entry.prefix())
-                .build();
-
-        TrafficTreatment treatment = DefaultTrafficTreatment.builder()
-                .group(group.id())
-                .build();
-
-        FlowRule flowRule = new DefaultFlowRule(deviceId, selector, treatment,
-                                                PRIORITY, appId, 0, true,
-                                                FlowRule.Type.IP);
+        FlowRule flowRule = generateRibFlowRule(entry.prefix(), group);
 
         flowService.applyFlowRules(flowRule);
     }
@@ -231,21 +220,33 @@
         for (FibUpdate update : withdraws) {
             FibEntry entry = update.entry();
 
-            deleteNextHop(entry.prefix());
+            Group group = deleteNextHop(entry.prefix());
+            if (group == null) {
+                log.warn("Group not found when deleting {}", entry);
+                return;
+            }
 
-            TrafficSelector selector = DefaultTrafficSelector.builder()
-                    .matchEthType(Ethernet.TYPE_IPV4)
-                    .matchIPDst(update.entry().prefix())
-                    .build();
-
-            FlowRule flowRule = new DefaultFlowRule(deviceId, selector, null,
-                                                    PRIORITY, appId, 0, true,
-                                                    FlowRule.Type.IP);
+            FlowRule flowRule = generateRibFlowRule(entry.prefix(), group);
 
             flowService.removeFlowRules(flowRule);
         }
     }
 
+    private FlowRule generateRibFlowRule(IpPrefix prefix, Group group) {
+        TrafficSelector selector = DefaultTrafficSelector.builder()
+                .matchEthType(Ethernet.TYPE_IPV4)
+                .matchIPDst(prefix)
+                .build();
+
+        TrafficTreatment treatment = DefaultTrafficTreatment.builder()
+                .group(group.id())
+                .build();
+
+        return new DefaultFlowRule(deviceId, selector, treatment,
+                                   PRIORITY, appId, 0, true,
+                                   FlowRule.Type.IP);
+    }
+
     private synchronized void addNextHop(FibEntry entry) {
         prefixToNextHop.put(entry.prefix(), entry.nextHopIp());
         if (nextHopsCount.count(entry.nextHopIp()) == 0) {
@@ -288,14 +289,16 @@
         nextHopsCount.add(entry.nextHopIp());
     }
 
-    private synchronized void deleteNextHop(IpPrefix prefix) {
+    private synchronized Group deleteNextHop(IpPrefix prefix) {
         IpAddress nextHopIp = prefixToNextHop.remove(prefix);
         NextHop nextHop = nextHops.get(nextHopIp);
         if (nextHop == null) {
             log.warn("No next hop found when removing prefix {}", prefix);
-            return;
+            return null;
         }
 
+        Group group = groupService.getGroup(deviceId, nextHop.group());
+
         if (nextHopsCount.remove(nextHopIp, 1) <= 1) {
             // There was one or less next hops, so there are now none
 
@@ -305,6 +308,8 @@
 
             groupService.removeGroup(deviceId, nextHop.group(), appId);
         }
+
+        return group;
     }
 
     private class InternalFibListener implements FibListener {
diff --git a/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowModBuilderVer13.java b/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowModBuilderVer13.java
index cf4f490..dc6a857 100644
--- a/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowModBuilderVer13.java
+++ b/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowModBuilderVer13.java
@@ -180,6 +180,7 @@
                 .setMatch(match)
                 .setFlags(Collections.singleton(OFFlowModFlags.SEND_FLOW_REM))
                 .setPriority(flowRule().priority())
+                .setTableId(TableId.of(flowRule().type().ordinal()))
                 .build();
 
         return fm;
