diff --git a/pbx/pbx_lua.c b/pbx/pbx_lua.c
index 49d0ae51dbee40cb9ac8a340950b5be2f7eaf403..193f031a57713c897f34dbd8b33f317c1780833a 100644
--- a/pbx/pbx_lua.c
+++ b/pbx/pbx_lua.c
@@ -1304,12 +1304,14 @@ static int reload(void)
 
 static int load_module(void)
 {
-	if (load_or_reload_lua_stuff())
-		return AST_MODULE_LOAD_FAILURE;
+	int res;
+
+	if ((res = load_or_reload_lua_stuff()))
+		return res;
 
 	if (ast_register_switch(&lua_switch)) {
 		ast_log(LOG_ERROR, "Unable to register LUA PBX switch\n");
-		return AST_MODULE_LOAD_FAILURE;
+		return AST_MODULE_LOAD_DECLINE;
 	}
 
 	return AST_MODULE_LOAD_SUCCESS;