--- a/projects/TGScheduler/trunk/tgscheduler/kronos.py
+++ b/projects/TGScheduler/trunk/tgscheduler/kronos.py
@@ -410,8 +410,7 @@
     def rename(self, taskname, newname):
         """Rename a scheduled task."""
         if taskname and taskname in self.tasks:
-            task = self.tasks[taskname]
-            del self.tasks[taskname]
+            task = self.tasks.pop(taskname)
             task.name = newname
             self.tasks[newname] = task