Fix mode switching