fixed lua stack overflow