diff --git a/tunmgr/tunmgr.py b/tunmgr/tunmgr.py
index d600572fb6438985e33616291f3fe2b99380c3c3..89751611482143fb0880963d5bb6bdce3324a48a 100755
--- a/tunmgr/tunmgr.py
+++ b/tunmgr/tunmgr.py
@@ -33,11 +33,15 @@ while 1:
     for key, events in sel.select():
         try:
             if key.data=="tun":
-                print("tun")
-                s.sendto(base64.b64encode(tun.read(tun.mtu)), (PEER, PORT))
+                msg = tun.read(tun.mtu)
+                print("tun", msg, len(msg), "bytes")
+                msg = base64.b64encode(msg)+b"\n"
+                print("base64", msg, len(msg), "bytes")
+                print(msg, (PEER, PORT))
+                s.sendto(msg, (PEER, PORT))
             elif key.data == "sms":
                 print("sms")
-                tun.write(base64.b64decode(s.recv(tun.mtu*4))+b"\n")
+                tun.write(base64.b64decode(s.recv(tun.mtu*4)))
         except Exception:
             traceback.print_exc()