diff --git a/src/sbbs3/js_internal.c b/src/sbbs3/js_internal.c
index f90d270d4defdd9895bf60b92336469bb481803b..63ab04784c931816ec50e164e137881e94e52f66 100644
--- a/src/sbbs3/js_internal.c
+++ b/src/sbbs3/js_internal.c
@@ -466,7 +466,7 @@ js_execfile(JSContext *cx, uintN argc, jsval *arglist)
 	}
 	else {
 		jsval exit_code = JSVAL_VOID;
-		if(JS_GetProperty(cx, js_scope, "exit_code", &exit_code) && JSVAL_IS_NUMBER(exit_code))
+		if(JS_GetProperty(cx, js_scope, "exit_code", &exit_code) && exit_code != JSVAL_VOID)
 			rval = exit_code;
 	}
 	JS_SET_RVAL(cx, arglist, rval);