Fix stack errors