Fix switching bug