revert to using stack length