bug fix on stacks