Fix a stack depth calculation.