diff --git a/src/opcodes.c b/src/opcodes.c
index af4de92787c827469412cdb50d6628d288a81731..8ffec86c46f289fa743bb279189bd6ff2ce2cd69 100644
--- a/src/opcodes.c
+++ b/src/opcodes.c
@@ -353,6 +353,9 @@ void o_cast(struct pike_string *type, INT32 run_time_type)
 	  case T_FUNCTION:
 	    sp[-1].type = T_OBJECT;
 	    break;
+
+	  default:
+	    error("Cannot cast to object.\n");
 	}
 	break;
 	
@@ -393,7 +396,7 @@ void o_cast(struct pike_string *type, INT32 run_time_type)
 
 #ifdef DEBUG
   if(run_time_type != sp[-1].type)
-    fatal("Internal error: Cast failed (run_time_type = %d, sp[-1].type = %d.)\n");
+    fatal("Internal error: Cast failed (run_time_type = %d, sp[-1].type = %d.)\n",run_time_type,sp[-1].type);
 #endif
 
   switch(run_time_type)