fix: crash while switching modes