diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 7b2237e..41884d3 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -154,6 +154,7 @@
     private final SubtypeSwitcher mSubtypeSwitcher;
     private boolean mShouldSwitchToLastSubtype = true;
 
+    private boolean mIsMainDictionaryAvailable;
     private UserDictionary mUserDictionary;
     private UserHistoryDictionary mUserHistoryDictionary;
     private boolean mIsUserDictionaryAvailable;
@@ -449,14 +450,14 @@
                 return new SettingsValues(mPrefs, LatinIME.this);
             }
         };
-        mSettingsValues = job.runInLocale(mResources, mSubtypeSwitcher.getInputLocale());
+        mSettingsValues = job.runInLocale(mResources, mSubtypeSwitcher.getCurrentSubtypeLocale());
         mFeedbackManager = new AudioAndHapticFeedbackManager(this, mSettingsValues);
         resetContactsDictionary(null == mSuggest ? null : mSuggest.getContactsDictionary());
     }
 
     private void initSuggest() {
-        final Locale keyboardLocale = mSubtypeSwitcher.getInputLocale();
-        final String localeStr = keyboardLocale.toString();
+        final Locale subtypeLocale = mSubtypeSwitcher.getCurrentSubtypeLocale();
+        final String localeStr = subtypeLocale.toString();
 
         final Dictionary oldContactsDictionary;
         if (mSuggest != null) {
@@ -465,11 +466,13 @@
         } else {
             oldContactsDictionary = null;
         }
-        mSuggest = new Suggest(this, keyboardLocale);
+        mSuggest = new Suggest(this, subtypeLocale);
         if (mSettingsValues.mAutoCorrectEnabled) {
             mSuggest.setAutoCorrectionThreshold(mSettingsValues.mAutoCorrectionThreshold);
         }
 
+        mIsMainDictionaryAvailable = DictionaryFactory.isDictionaryAvailable(this, subtypeLocale);
+
         mUserDictionary = new UserDictionary(this, localeStr);
         mSuggest.setUserDictionary(mUserDictionary);
         mIsUserDictionaryAvailable = mUserDictionary.isEnabled();
@@ -511,7 +514,7 @@
         } else {
             if (USE_BINARY_CONTACTS_DICTIONARY) {
                 dictionaryToUse = new ContactsBinaryDictionary(this, Suggest.DIC_CONTACTS,
-                        mSubtypeSwitcher.getInputLocale());
+                        mSubtypeSwitcher.getCurrentSubtypeLocale());
             } else {
                 dictionaryToUse = new ContactsDictionary(this, Suggest.DIC_CONTACTS);
             }
@@ -523,7 +526,9 @@
     }
 
     /* package private */ void resetSuggestMainDict() {
-        mSuggest.resetMainDict(this, mSubtypeSwitcher.getInputLocale());
+        final Locale subtypeLocale = mSubtypeSwitcher.getCurrentSubtypeLocale();
+        mSuggest.resetMainDict(this, subtypeLocale);
+        mIsMainDictionaryAvailable = DictionaryFactory.isDictionaryAvailable(this, subtypeLocale);
     }
 
     @Override
@@ -603,7 +608,7 @@
 
     @Override
     public void onCurrentInputMethodSubtypeChanged(InputMethodSubtype subtype) {
-        SubtypeSwitcher.getInstance().updateSubtype(subtype);
+        mSubtypeSwitcher.updateSubtype(subtype);
     }
 
     private void onStartInputInternal(EditorInfo editorInfo, boolean restarting) {
@@ -1894,7 +1899,7 @@
             if (mSettingsValues.mEnableSuggestionSpanInsertion) {
                 final SuggestedWords suggestedWords = mSuggestionsView.getSuggestions();
                 ic.commitText(SuggestionSpanUtils.getTextWithSuggestionSpan(
-                        this, bestWord, suggestedWords, mSubtypeSwitcher.isDictionaryAvailable()),
+                        this, bestWord, suggestedWords, mIsMainDictionaryAvailable),
                         1);
                 if (ProductionFlag.IS_EXPERIMENTAL) {
                     ResearchLogger.latinIME_commitText(bestWord);
@@ -1972,7 +1977,8 @@
             }
             final String secondWord;
             if (mWordComposer.isAutoCapitalized() && !mWordComposer.isMostlyCaps()) {
-                secondWord = suggestion.toString().toLowerCase(mSubtypeSwitcher.getInputLocale());
+                secondWord = suggestion.toString().toLowerCase(
+                        mSubtypeSwitcher.getCurrentSubtypeLocale());
             } else {
                 secondWord = suggestion.toString();
             }
@@ -2300,8 +2306,7 @@
     }
 
     private void showOptionDialogInternal(AlertDialog dialog) {
-        final IBinder windowToken = KeyboardSwitcher.getInstance().getKeyboardView()
-                .getWindowToken();
+        final IBinder windowToken = mKeyboardSwitcher.getKeyboardView().getWindowToken();
         if (windowToken == null) return;
 
         dialog.setCancelable(true);
diff --git a/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java b/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java
index 877332a..3b9a406 100644
--- a/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java
+++ b/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java
@@ -50,7 +50,6 @@
     /*-----------------------------------------------------------*/
     // Variants which should be changed only by reload functions.
     private NeedsToDisplayLanguage mNeedsToDisplayLanguage = new NeedsToDisplayLanguage();
-    private boolean mIsDictionaryAvailable;
     private InputMethodInfo mShortcutInputMethodInfo;
     private InputMethodSubtype mShortcutSubtype;
     private InputMethodSubtype mNoLanguageSubtype;
@@ -188,7 +187,6 @@
         final Locale newLocale = SubtypeLocale.getSubtypeLocale(newSubtype);
         mNeedsToDisplayLanguage.updateIsSystemLanguageSameAsInputLanguage(
                 mCurrentSystemLocale.equals(newLocale));
-        mIsDictionaryAvailable = DictionaryFactory.isDictionaryAvailable(mService, newLocale);
 
         mCurrentSubtype = newSubtype;
         updateShortcutIME();
@@ -267,13 +265,13 @@
         if (keyboardLocale.toString().equals(SubtypeLocale.NO_LANGUAGE)) {
             return true;
         }
-        if (!keyboardLocale.equals(getInputLocale())) {
+        if (!keyboardLocale.equals(getCurrentSubtypeLocale())) {
             return false;
         }
         return mNeedsToDisplayLanguage.getValue();
     }
 
-    public Locale getInputLocale() {
+    public Locale getCurrentSubtypeLocale() {
         return SubtypeLocale.getSubtypeLocale(mCurrentSubtype);
     }
 
@@ -285,10 +283,6 @@
         }
     }
 
-    public boolean isDictionaryAvailable() {
-        return mIsDictionaryAvailable;
-    }
-
     public InputMethodSubtype getCurrentSubtype() {
         return mCurrentSubtype;
     }
