Make mode switching more sensible