diff --git a/lib/modules/Thread.pmod b/lib/modules/Thread.pmod
index c0fdc25110e05c56100d7398722e8f069b162b89..d13cf163df50fcce188325672ec08b8d4cc30c6d 100644
--- a/lib/modules/Thread.pmod
+++ b/lib/modules/Thread.pmod
@@ -239,6 +239,8 @@ optional class Fifo {
 
   protected string _sprintf( int f )
   {
+    if (!this)				// Only if not destructed
+      return UNDEFINED;
     return f=='O' && sprintf( "%O(%d / %d)", this_program,
 			      size(), read_tres );
   }
@@ -407,6 +409,8 @@ optional class Queue {
 
   protected string _sprintf( int f )
   {
+    if (!this)				// Only if not destructed
+      return UNDEFINED;
     return f=='O' && sprintf( "%O(%d)", this_program, size() );
   }
 }
@@ -506,6 +510,8 @@ optional class Farm
 
     protected string _sprintf( int f )
     {
+      if (!this)				// Only if not destructed
+        return UNDEFINED;
       switch( f )
       {
 	case 't':
@@ -620,6 +626,8 @@ optional class Farm
 
     protected string _sprintf( int f )
     {
+      if (!this)				// Only if not destructed
+        return UNDEFINED;
       switch( f )
       {
 	case 't':
@@ -864,6 +872,8 @@ optional class Farm
 
   protected string _sprintf( int f )
   {
+    if (!this)				// Only if not destructed
+      return UNDEFINED;
     return f=='O' && sprintf( "%O(/* %s */)", this_program, debug_status() );
   }
 
@@ -939,6 +949,8 @@ optional class ResourceCount {
 
   /*semi*/private string _sprintf(int type) {
     string res = UNDEFINED;
+    if (!this)				// Only if not destructed
+      return UNDEFINED;
     switch(type) {
       case 'O':
         res = sprintf("Count: %d", _count);
@@ -1139,6 +1151,8 @@ optional class Fifo
 
   protected string _sprintf( int f )
   {
+    if (!this)				// Only if not destructed
+      return UNDEFINED;
     return f=='O' && sprintf( "%O(%d / %d)", this_program,
 			      size(), read_tres );
   }
@@ -1217,6 +1231,8 @@ optional class Queue
 
   protected string _sprintf( int f )
   {
+    if (!this)				// Only if not destructed
+      return UNDEFINED;
     return f=='O' && sprintf( "%O(%d)", this_program, size() );
   }
 }
@@ -1263,6 +1279,8 @@ class ResourceCount {
   protected string _sprintf(int type)
   {
     string res = UNDEFINED;
+    if (!this)				// Only if not destructed
+      return UNDEFINED;
     switch(type) {
       case 'O':
         res = sprintf("Count: %d", _count);