add a condition test to avoid unnecessary IME switch