fixed mode switching
Merge branch 'fix/mode_switch'