diff --git a/Script/CastorScript.py b/Script/CastorScript.py
index 717715716fed4a5d5e3d5e1db69c87ad00ad9066..06e8fc536c541bcc6ac3d2865436132bba43f236 100644
--- a/Script/CastorScript.py
+++ b/Script/CastorScript.py
@@ -353,16 +353,24 @@ def krb_tokenexpiration(logger):
     klist = subprocess.Popen(['klist',], env = envm, stdout=subprocess.PIPE,
                              stderr=subprocess.STDOUT)
     ret = klist.wait()
-
     out = klist.stdout.read()
     logger.debug('klist done. Return code: %d  Output: %s' % (ret,out))
 
+    if ret:
+        self.logger.critical('klist failed: retcode=%s, output=%s', str(ret), out)
+        return datetime.datetime(1970, 1, 1)
+
+    ticket = None
     out = out.split('\n')
     for idx,l in enumerate(out):
         if 'Valid' in l:
             ticket = out[idx+1]
             break
 
+    if ticket is None:
+        self.logger.critical('error parsing klist output: output=%s', out)
+        return datetime.datetime(1970, 1, 1)
+
     ticket = ticket.split()
     logger.debug('Ticket expiration: %s' % ticket)
     return datetime.datetime.strptime(' '.join(ticket[2:4]), \