fix bug in reinit_lua_thread_env