Optimize the stack grow / shrink logic
Eliminate error cases on shrink