updated predefined functions
diff --git a/tests/FuncUtils.py b/tests/FuncUtils.py
index 96fc6cf..d14ee71 100644
--- a/tests/FuncUtils.py
+++ b/tests/FuncUtils.py
@@ -14,6 +14,7 @@
 import types
 import basic
 from testutils import *
+from time import sleep
 
 #################### Functions for various types of flow_mod  ##########################################################################################
 
@@ -82,13 +83,15 @@
         match2 = parse.packet_to_flow_match(Pkt_Wildcard)
         self.assertTrue(match2 is not None, "Could not generate flow match from pkt")
         match2.wildcards=ofp.OFPFW_ALL
+        match2.in_port = of_ports[0]
+
         msg2 = message.flow_mod()
         msg2.out_port = ofp.OFPP_NONE
         msg2.command = ofp.OFPFC_ADD
         msg2.buffer_id = 0xffffffff
         msg2.match = match2
         act2 = action.action_output()
-        act2.port = of_ports[2]
+        act2.port = of_ports[1]
         self.assertTrue(msg2.actions.add(act2), "could not add action")
         if priority != 0 :
                 msg2.priority = priority
@@ -181,7 +184,7 @@
 
 ###########################   Verify Stats Functions   ###########################################################################################
 
-def Verify_TableStats(self,active_entries=0):
+def Verify_TableStats(self,active_entries=0,):
 #Verify Table_Stats
         
         #Send Table_Stats_Request        
@@ -196,27 +199,31 @@
         self.assertTrue(active_entries == active_count,"Incorrect no. of flows in Table")
 
 
-def Verify_FlowStats(self,match,stats_byte_count=0,stats_packet_count=0):
-# Verify Flow_Stats
+def Verify_FlowStats(self,match,byte_count=0,packet_count=0):
+# Verify flow counters : byte_count and packet_count
 
-        # Send Flow_Stats_Request       
-        request = message.flow_stats_request()
-        request.out_port = ofp.OFPP_NONE
-        request.table_id = 0xff
-        request.match = match
-        response, pkt = self.controller.transact(request, timeout=1)
-        self.assertTrue(response is not None, "Did not get response")
-        byte_count = 0 
-        packet_count = 0
+        stat_req = message.flow_stats_request()
+        stat_req.match = match
+        stat_req.table_id = 0xff
+        stat_req.out_port = ofp.OFPP_NONE
+        test_timeout = 10
+        all_packets_received = 0
+        for i in range(0,test_timeout):
+            
+            response, pkt = self.controller.transact(stat_req,
+                                                     timeout=test_timeout)
+            self.assertTrue(response is not None, 
+                            "No response to stats request")
+            for obj in response.stats:
+                if ( obj.packet_count == packet_count and obj.byte_count == byte_count ) :
+                    all_packets_received = 1
 
-        #Verify byte_count and packet_count in the reply
-        for stat in response.stats:
-            byte_count += stat.byte_count
-            packet_count += stat.packet_count
-            self.assertEqual(stats_byte_count,byte_count,
-                        "Byte counter is incorrect")
-            self.assertEqual(stats_packet_count,packet_count,
-                        "Packet counter is incorrect")
+            if all_packets_received:
+                break
+            sleep(1)
+
+        self.assertTrue(all_packets_received,
+                        "Flow counters are incorrect")
 
 
 ############################## Various delete commands #############################################################################################