mode switching work properly