lua : fix runaway stacks causing crashes