Fixes to the sample method of Stack