Fix undo save/restore on tab change problem