diff --git a/TestON/tests/HAclusterRestart/dependencies/Counters.py b/TestON/tests/HAclusterRestart/dependencies/Counters.py
index 6614887..2dc95e1 100644
--- a/TestON/tests/HAclusterRestart/dependencies/Counters.py
+++ b/TestON/tests/HAclusterRestart/dependencies/Counters.py
@@ -11,56 +11,62 @@
         nodes or main.FALSE
     """
     import json
-    correctResults = main.TRUE
-    # Get onos counters results
-    onosCountersRaw = []
-    threads = []
-    for i in range( main.numCtrls ):
-        t = main.Thread( target=main.CLIs[i].counters,
-                         name="counters-" + str( i ) )
-        threads.append( t )
-        t.start()
-    for t in threads:
-        t.join()
-        onosCountersRaw.append( t.result )
-    onosCounters = []
-    for i in range( main.numCtrls ):
-        try:
-            onosCounters.append( json.loads( onosCountersRaw[i] ) )
-        except ( ValueError, TypeError ):
-            main.log.error( "Could not parse counters response from ONOS" +
-                            str( i + 1 ) )
-            main.log.warn( repr( onosCountersRaw[ i ] ) )
-            return main.FALSE
+    try:
+        correctResults = main.TRUE
+        # Get onos counters results
+        onosCountersRaw = []
+        threads = []
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].counters,
+                             name="counters-" + str( i ) )
+            threads.append( t )
+            t.start()
+        for t in threads:
+            t.join()
+            onosCountersRaw.append( t.result )
+        onosCounters = []
+        for i in range( main.numCtrls ):
+            try:
+                onosCounters.append( json.loads( onosCountersRaw[i] ) )
+            except ( ValueError, TypeError ):
+                main.log.error( "Could not parse counters response from ONOS" +
+                                str( i + 1 ) )
+                main.log.warn( repr( onosCountersRaw[ i ] ) )
+                onosCounters.append( [] )
+                return main.FALSE
 
-    testCounters = {}
-    # make a list of all the "TestON-*" counters in ONOS
-    # lookes like a dict whose keys are the name of the ONOS node and values
-    # are a list of the counters. I.E.
-    # { "ONOS1": [ {"name":"TestON-inMemory","value":56},
-    #              {"name":"TestON-Partitions","value":56} ]
-    # }
-    # NOTE: There is an assumtion that all nodes are active
-    #        based on the above for loops
-    for controller in enumerate( onosCounters ):
-        for dbType in controller[1]:
-            for dbName, items in dbType.iteritems():
-                for item in items:
-                    if 'TestON' in item['name']:
-                        node = 'ONOS' + str( controller[0] + 1 )
-                        try:
-                            testCounters[node].append( item )
-                        except KeyError:
-                            testCounters[node] = [ item ]
-    # compare the counters on each node
-    tmp = [ v == testCounters['ONOS1'] for k, v in testCounters.iteritems() ]
-    if all( tmp ):
-        consistent = main.TRUE
-    else:
-        consistent = main.FALSE
-        main.log.error( "ONOS nodes have different values for counters:\n" +
-                        testCounters )
-    return ( onosCounters, consistent )
+        testCounters = {}
+        # make a list of all the "TestON-*" counters in ONOS
+        # lookes like a dict whose keys are the name of the ONOS node and values
+        # are a list of the counters. I.E.
+        # { "ONOS1": [ {"name":"TestON-inMemory","value":56},
+        #              {"name":"TestON-Partitions","value":56} ]
+        # }
+        # NOTE: There is an assumtion that all nodes are active
+        #        based on the above for loops
+        for controller in enumerate( onosCounters ):
+            for dbType in controller[1]:
+                for dbName, items in dbType.iteritems():
+                    for item in items:
+                        if 'TestON' in item['name']:
+                            node = 'ONOS' + str( controller[0] + 1 )
+                            try:
+                                testCounters[node].append( item )
+                            except KeyError:
+                                testCounters[node] = [ item ]
+        # compare the counters on each node
+        tmp = [ v == testCounters['ONOS1'] for k, v in testCounters.iteritems() ]
+        if all( tmp ):
+            consistent = main.TRUE
+        else:
+            consistent = main.FALSE
+            main.log.error( "ONOS nodes have different values for counters:\n" +
+                            testCounters )
+        return ( onosCounters, consistent )
+    except Exception:
+        main.log.exception( "" )
+        main.cleanup()
+        main.exit()
 
 def counterCheck( counterName, counterValue ):
     """
