Fix lua stack corruption