diff --git a/examples/udpbwtest.py b/examples/udpbwtest.py
index 74dcda5a5355f07920200fcbe1baf16a554bceb1..9832d18c0af91c63cc762b13086132fa8c1ccb60 100755
--- a/examples/udpbwtest.py
+++ b/examples/udpbwtest.py
@@ -35,8 +35,8 @@
 def readline( host, buf ):
     "Read a line from a host, buffering with buffer."
     buf += host.read( 1024 )
-    if '\n' not in buffer:
-        return None, buffer
+    if '\n' not in buf:
+        return None, buf
     pos = buf.find( '\n' )
     line = buf[ 0 : pos ]
     rest = buf[ pos + 1: ]
@@ -130,7 +130,7 @@ def udpbwtest( net, seconds ):
     printTotalHeader()
     times = sorted( results.keys() )
     for t in times:
-        printTotal( t - t[ 0 ] , results[ t ] )
+        printTotal( t - times[ 0 ] , results[ t ] )
     print
 
 # pylint: enable-msg=E1101