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 1c02578..44d6640 100644
--- a/apps/bgprouter/src/main/java/org/onosproject/bgprouter/BgpRouter.java
+++ b/apps/bgprouter/src/main/java/org/onosproject/bgprouter/BgpRouter.java
@@ -27,11 +27,8 @@
 import org.apache.felix.scr.annotations.Reference;
 import org.apache.felix.scr.annotations.ReferenceCardinality;
 import org.onlab.packet.Ethernet;
-import org.onlab.packet.Ip4Address;
-import org.onlab.packet.Ip4Prefix;
 import org.onlab.packet.IpAddress;
 import org.onlab.packet.IpPrefix;
-import org.onlab.packet.MacAddress;
 import org.onosproject.config.NetworkConfigService;
 import org.onosproject.core.ApplicationId;
 import org.onosproject.core.CoreService;
@@ -66,13 +63,10 @@
 import org.slf4j.LoggerFactory;
 
 import java.util.Collection;
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Set;
 
-import static org.onlab.util.Tools.delay;
-
 /**
  * BgpRouter component.
  */
@@ -226,7 +220,7 @@
 
         for (FibUpdate update : withdraws) {
             FibEntry entry = update.entry();
-            Integer nextId = nextHops.get(entry.nextHopIp());
+            //Integer nextId = nextHops.get(entry.nextHopIp());
 
            /* Group group = deleteNextHop(entry.prefix());
             if (group == null) {
@@ -235,7 +229,7 @@
             }*/
 
             flowObjectiveService.forward(deviceId,
-                generateRibForwardingObj(entry.prefix(), nextId).remove());
+                generateRibForwardingObj(entry.prefix(), null).remove());
 
         }
 
@@ -253,11 +247,15 @@
         ForwardingObjective.Builder fwdBuilder = DefaultForwardingObjective.builder()
                 .fromApp(appId)
                 .makePermanent()
-                .nextStep(nextId)
                 .withSelector(selector)
                 .withPriority(priority)
                 .withFlag(ForwardingObjective.Flag.SPECIFIC);
 
+        if (nextId == null) {
+            fwdBuilder.withTreatment(DefaultTrafficTreatment.builder().build());
+        } else {
+            fwdBuilder.nextStep(nextId);
+        }
         return fwdBuilder;
     }
 
@@ -384,13 +382,14 @@
                         if (event.subject().id().equals(deviceId)) {
                             processIntfFilters(true, configService.getInterfaces());
 
-                            /* For test only - will be removed before Cardinal release */
+                            /* For test only - will be removed before Cardinal release
                             delay(1000);
                             FibEntry fibEntry = new FibEntry(Ip4Prefix.valueOf("10.1.0.0/16"),
                                     Ip4Address.valueOf("192.168.10.1"),
                                     MacAddress.valueOf("DE:AD:BE:EF:FE:ED"));
                             FibUpdate fibUpdate = new FibUpdate(FibUpdate.Type.UPDATE, fibEntry);
                             updateFibEntry(Collections.singletonList(fibUpdate));
+                            */
                         }
 
                         if (event.subject().id().equals(ctrlDeviceId)) {
diff --git a/drivers/src/main/java/org/onosproject/driver/pipeline/OVSCorsaPipeline.java b/drivers/src/main/java/org/onosproject/driver/pipeline/OVSCorsaPipeline.java
index a92dbe1..1620c33 100644
--- a/drivers/src/main/java/org/onosproject/driver/pipeline/OVSCorsaPipeline.java
+++ b/drivers/src/main/java/org/onosproject/driver/pipeline/OVSCorsaPipeline.java
@@ -317,28 +317,26 @@
                                         selector.getCriterion(Criterion.Type.IPV4_DST)).ip())
                         .build();
 
-        NextGroup next = flowObjectiveStore.getNextGroup(fwd.nextId());
+        TrafficTreatment.Builder tb = DefaultTrafficTreatment.builder();
 
-        GroupKey key = appKryo.deserialize(next.data());
-
-        Group group = groupService.getGroup(deviceId, key);
-
-        if (group == null) {
-            log.warn("The group left!");
-            fail(fwd, ObjectiveError.GROUPMISSING);
-            return Collections.emptySet();
+        if (fwd.nextId() != null) {
+            NextGroup next = flowObjectiveStore.getNextGroup(fwd.nextId());
+            GroupKey key = appKryo.deserialize(next.data());
+            Group group = groupService.getGroup(deviceId, key);
+            if (group == null) {
+                log.warn("The group left!");
+                fail(fwd, ObjectiveError.GROUPMISSING);
+                return Collections.emptySet();
+            }
+            tb.group(group.id());
         }
 
-        TrafficTreatment treatment = DefaultTrafficTreatment.builder()
-                .group(group.id())
-                .build();
-
         FlowRule.Builder ruleBuilder = DefaultFlowRule.builder()
                 .fromApp(fwd.appId())
                 .withPriority(fwd.priority())
                 .forDevice(deviceId)
                 .withSelector(filteredSelector)
-                .withTreatment(treatment);
+                .withTreatment(tb.build());
 
         if (fwd.permanent()) {
             ruleBuilder.makePermanent();
