Fix stack bug