diff --git a/src/lua/utils.c b/src/lua/utils.c
index d690c42799e2ce9960ada71c556b0ed0969a2493..acae0e534010434338fa6a2faf5299111304ff87 100644
--- a/src/lua/utils.c
+++ b/src/lua/utils.c
@@ -66,7 +66,7 @@ index2adr(lua_State *L, int idx)
 		TValue *o = L->base + (idx - 1);
 		return o < L->top ? o : niltv(L);
 	} else if (idx > LUA_REGISTRYINDEX) {
-		api_check(L, idx != 0 && -idx <= L->top - L->base);
+		assert(idx != 0 && -idx <= L->top - L->base);
 		return L->top + idx;
 	} else if (idx == LUA_GLOBALSINDEX) {
 		TValue *o = &G(L)->tmptv;
@@ -76,7 +76,7 @@ index2adr(lua_State *L, int idx)
 		return registry(L);
 	} else {
 		GCfunc *fn = curr_func(L);
-		api_check(L, fn->c.gct == ~LJ_TFUNC && !isluafunc(fn));
+		assert(fn->c.gct == ~LJ_TFUNC && !isluafunc(fn));
 		if (idx == LUA_ENVIRONINDEX) {
 			TValue *o = &G(L)->tmptv;
 			settabV(L, o, tabref(fn->c.env));