Undo was not working for stacks