diff --git a/Script/castorstorage.py b/Script/castorstorage.py
index 0c1db301bb93fe6e8ead2985d2fe5ba0e9842934..f3c2efc772338519b66ee8f61b69670700a0c9ee 100644
--- a/Script/castorstorage.py
+++ b/Script/castorstorage.py
@@ -91,8 +91,9 @@ def listdir(directory, stager, pool, logger=None):
 
     nsls = Popen(['nsls', directory],
                  stdout=PIPE, stderr=STDOUT, env=_castorenv(stager,pool))
+    nslsOut,_ = nsls.communicate()
     ret = nsls.wait()
-    nslsOut = nsls.stdout.read()
+
     
     if logger:
         logInfo = {'file':logger.findCaller()[0],