diff --git a/lib/modules/Thread.pmod b/lib/modules/Thread.pmod
index 915fb34566edd8969e3890c883d1df8cc71055c6..3770e2e2db4f60e848b63f45ba1817118c85ea82 100644
--- a/lib/modules/Thread.pmod
+++ b/lib/modules/Thread.pmod
@@ -556,6 +556,7 @@ optional class Farm
           total_time += st/1000.0;
           handled++;
           job = 0;
+          q = 0;
           if( st > max_time )
             max_time = st;
           ft_cond->broadcast();
@@ -642,8 +643,10 @@ optional class Farm
 
   protected void dispatcher()
   {
-    while( array q = [array]job_queue->read() )
+    while( array q = [array]job_queue->read() ) {
       aquire_thread()->run( q[1], q[0] );
+      q = 0;
+    }
     if (thread_name_cb)
       thread_name_cb(this_thread(), 0);
   }