refactor and repairs for StackManager teardown