diff --git a/primary.py b/primary.py
index 938527232de1ae7913cca0b594da6f59a0bf025c..e4d528f7edef8b8afaa5fb1d1526b2951bf1a496 100644
--- a/primary.py
+++ b/primary.py
@@ -113,15 +113,15 @@ class Server:
                        self.config.primary.mount.path,
                        self.path)
         cwd = os.path.join(self.config.primary.mount.path, self.path)
-        stdin =  tar_socket.makefile('rb')
+        #stdin =  tar_socket.makefile('rb')
         stdout =  tar_socket.makefile('wb')
         try:
-            def readlines_nul(f):
+            def readlines_nul(s):
                 buf = b''
                 while True:
                     pos = buf.find(b'\x00')
                     if pos == -1:
-                        tmp = f.read(4096)
+                        tmp = s.recv(4096)
                         print('Got:', len(tmp), file=sys.stderr)
                         if len(tmp) == 0:
                             if len(buf) == 0:
@@ -135,7 +135,7 @@ class Server:
                     pass
                 pass
             writer = tar_stream.TarWriter(stdout)
-            for path in readlines_nul(stdin):
+            for path in readlines_nul(tar_socket):
                 arcname = path.decode('utf8', errors='surrogateescape')
                 try:
                     full_path = os.path.join(cwd, arcname)