diff --git a/mininet/node.py b/mininet/node.py
index f8ec8c9..7f3c4c7 100644
--- a/mininet/node.py
+++ b/mininet/node.py
@@ -553,7 +553,7 @@
     pass
 
 
-        
+
 class CPULimitedHost( Host ):
 
     "CPU limited host"
@@ -592,7 +592,7 @@
         "Return value of cgroup parameter"
         cmd = 'cgget -r %s.%s /%s' % (
             resource, param, self.name )
-        
+
         return int(quietRun( cmd ).split()[ -1 ] )
 
     def cgroupDel( self ):
@@ -721,29 +721,31 @@
 
     def __init__( self, name, **kwargs ):
 
-        
+
         Host.__init__( self, name, **kwargs )
         if not CCNHost.inited:
             CCNHost.init()
-           
+
+       # self.cmd("export CCND_DEBUG=6")
+       # self.cmd("export CCND_LOG=./log.{0}".format(self.name))
         self.cmd("export CCN_LOCAL_SOCKNAME=/tmp/.sock.ccnx.{0}".format(self.name))
         self.cmd("ccndstart")
         self.peerList = {}
 
     def config( self, fib=None, app=None, **params ):
-             
+
         r = Node.config( self, **params )
-        
+
         self.setParam( r, 'app', fib=fib )
         self.setParam( r, 'fib', app=app)
-        
+
         return r
-    
+
     def configCCN(self):
-        
+
         self.buildPeerIP()
         self.setFIB()
-    
+
     def buildPeerIP(self):
         for iface in self.intfList():
             link = iface.link
@@ -753,8 +755,8 @@
                     self.peerList[node2.name] = link.intf2.node.IP(link.intf2)
                 else:
                     self.peerList[node1.name] = link.intf1.node.IP(link.intf1)
-        
-        
+
+
     def setFIB(self):
 
         for name in self.params['fib']:
@@ -762,53 +764,57 @@
                 pass
             else:
                 self.insert_fib(name[0],self.peerList[name[1]])
-            
-        
+
+
     def insert_fib(self, uri, host):
         self.cmd('ccndc add {0} tcp {1}'.format(uri,host))
-        
+ #	 self.cmd('ccndc add {0} udp {1}'.format(uri,host))
+
     def terminate( self ):
         "Stop node."
         self.cmd('ccndstop')
+        self.cmd('killall -r zebra ospf')
         Host.terminate(self)
-        
+
     inited = False
 
-    
+
     @classmethod
     def init( cls ):
         "Initialization for CCNHost class"
         cls.inited = True
-        
+
 class CPULimitedCCNHost( CPULimitedHost ):
     '''CPULimitedCCNHost is a Host that always runs the ccnd daemon and extends CPULimitedHost.
        It should be used when one wants to limit the resources of CCN routers and hosts '''
-    
+
 
     def __init__( self, name, sched='cfs', **kwargs ):
-        
+
         CPULimitedHost.__init__( self, name, sched, **kwargs )
         if not CCNHost.inited:
             CCNHost.init()
-            
-        self.cmd("export CCN_LOCAL_SOCKNAME=/tmp/.sock.ccnx.{0}".format(self.name))
+
+       # self.cmd("export CCND_DEBUG=6")
+       # self.cmd("export CCND_LOG=./log.{0}".format(self.name))
+	self.cmd("export CCN_LOCAL_SOCKNAME=/tmp/.sock.ccnx.{0}".format(self.name))
         self.cmd("ccndstart")
         self.peerList = {}
 
-    def config( self, fib=None, app=None, cpu=None, cores=None, **params):   
+    def config( self, fib=None, app=None, cpu=None, cores=None, **params):
 
         r = CPULimitedHost.config(self,cpu,cores, **params)
-        
+
         self.setParam( r, 'app', fib=fib )
         self.setParam( r, 'fib', app=app)
-        
+
         return r
-    
+
     def configCCN(self):
-        
+
         self.buildPeerIP()
         self.setFIB()
-    
+
     def buildPeerIP(self):
         for iface in self.intfList():
             link = iface.link
@@ -818,8 +824,8 @@
                     self.peerList[node2.name] = link.intf2.node.IP(link.intf2)
                 else:
                     self.peerList[node1.name] = link.intf1.node.IP(link.intf1)
-        
-        
+
+
     def setFIB(self):
 
         for name in self.params['fib']:
@@ -827,19 +833,21 @@
                 pass
             else:
                 self.insert_fib(name[0],self.peerList[name[1]])
-            
-        
+
+
     def insert_fib(self, uri, host):
         self.cmd('ccndc add {0} tcp {1}'.format(uri,host))
-        
+#	self.cmd('ccndc add {0} udp {1}'.format(uri,host))
+
     def terminate( self ):
         "Stop node."
         self.cmd('ccndstop')
+        self.cmd('killall -r zebra ospf')
         Host.terminate(self)
-        
+
     inited = False
 
-    
+
     @classmethod
     def init( cls ):
         "Initialization for CCNHost class"
