Fix an overflow of the lua stack

Credits go to boucman for the fix.