Preserve mode when switching tabs