diff --git a/src/program.c b/src/program.c
index 6ba415afeb5561045bc7c611809987a986750274..54e4041a47d19dda041a00d2b5e7d2391e7bfbb2 100644
--- a/src/program.c
+++ b/src/program.c
@@ -4,7 +4,7 @@
 ||| See the files COPYING and DISCLAIMER for more information.
 \*/
 #include "global.h"
-RCSID("$Id: program.c,v 1.22 1997/02/19 05:07:18 hubbe Exp $");
+RCSID("$Id: program.c,v 1.23 1997/03/01 01:41:05 hubbe Exp $");
 #include "program.h"
 #include "object.h"
 #include "dynamic_buffer.h"
@@ -1088,6 +1088,8 @@ int end_class(char *name, INT32 flags)
   tmp.type=T_PROGRAM;
   tmp.subtype=0;
   tmp.u.program=end_program();
+  if(!tmp.u.program)
+    fatal("Failed to initialize class '%s'\n",name);
   ret=simple_add_constant(name, &tmp, flags);
   free_svalue(&tmp);
   return ret;
diff --git a/src/threads.c b/src/threads.c
index 905c94e5b15817fab24687de5c3c5fabc9a6c081..74cfba495bbce370c8daf1e6abbcc816c0ee6b33 100644
--- a/src/threads.c
+++ b/src/threads.c
@@ -1,5 +1,5 @@
 #include "global.h"
-RCSID("$Id: threads.c,v 1.17 1997/02/11 13:27:11 grubba Exp $");
+RCSID("$Id: threads.c,v 1.18 1997/03/01 01:41:06 hubbe Exp $");
 
 int num_threads = 1;
 int threads_disabled = 0;
@@ -348,6 +348,8 @@ void th_init()
   set_init_callback(init_mutex_key_obj);
   set_exit_callback(exit_mutex_key_obj);
   mutex_key=end_program();
+  if(!mutex_key)
+    fatal("Failed to initialize mutex_key program!\n");
 
   start_new_program();
   add_storage(sizeof(COND_T));
@@ -360,6 +362,8 @@ void th_init()
 
   start_new_program();
   thread_id_prog=end_program();
+  if(!mutex_key)
+    fatal("Failed to initialize thread program!\n");
 
   thread_id=clone(thread_id_prog,0);
 }