diff --git a/lib/jqueue.py b/lib/jqueue.py
index c6442f5717bd02c96336860dc5e3185fc112873f..66009fb5b56f723e9b2481b364cf477d98a1ba83 100644
--- a/lib/jqueue.py
+++ b/lib/jqueue.py
@@ -499,7 +499,7 @@ class JobQueue(object):
     # Remove master node
     try:
       del self._nodes[self._my_hostname]
-    except ValueError:
+    except KeyError:
       pass
 
     # TODO: Check consistency across nodes