diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index b8b57dc..5098494 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -2034,12 +2034,20 @@
             return;
         }
 
-        final CharSequence prevWord = EditingUtils.getThisWord(getCurrentInputConnection(),
-                mSettingsValues.mWordSeparators);
-        SuggestedWords.Builder builder = mSuggest.getBigramPredictionWordBuilder(prevWord,
-                mKeyboardSwitcher.getKeyboard().getProximityInfo(), mCorrectionMode);
+        final SuggestedWords.Builder builder;
+        if (mCorrectionMode == Suggest.CORRECTION_FULL_BIGRAM) {
+            final CharSequence prevWord = EditingUtils.getThisWord(getCurrentInputConnection(),
+                    mSettingsValues.mWordSeparators);
+            if (!TextUtils.isEmpty(prevWord)) {
+                builder = mSuggest.getBigramPredictionWordBuilder(prevWord);
+            } else {
+                builder = null;
+            }
+        } else {
+            builder = null;
+        }
 
-        if (builder.size() > 0) {
+        if (null == builder || builder.size() > 0) {
             // Explicitly supply an empty typed word (the no-second-arg version of
             // showSuggestions will retrieve the word near the cursor, we don't want that here)
             showSuggestions(builder.build(), "");
diff --git a/java/src/com/android/inputmethod/latin/Suggest.java b/java/src/com/android/inputmethod/latin/Suggest.java
index 034fe09..f3ba1e5 100644
--- a/java/src/com/android/inputmethod/latin/Suggest.java
+++ b/java/src/com/android/inputmethod/latin/Suggest.java
@@ -261,8 +261,7 @@
     }
 
     private static final WordComposer sEmptyWordComposer = new WordComposer();
-    public SuggestedWords.Builder getBigramPredictionWordBuilder(CharSequence prevWordForBigram,
-            final ProximityInfo proximityInfo, final int correctionMode) {
+    public SuggestedWords.Builder getBigramPredictionWordBuilder(CharSequence prevWordForBigram) {
         LatinImeLogger.onStartSuggestion(prevWordForBigram);
         mIsFirstCharCapitalized = false;
         mIsAllUpperCase = false;
@@ -274,25 +273,20 @@
         LatinImeLogger.onAddSuggestedWord("", Suggest.DIC_USER_TYPED, Dictionary.UNIGRAM);
         mConsideredWord = "";
 
-        if (correctionMode == CORRECTION_FULL_BIGRAM) {
-            // At first character typed, search only the bigrams
-            Arrays.fill(mBigramScores, 0);
-            collectGarbage(mBigramSuggestions, PREF_MAX_BIGRAMS);
+        Arrays.fill(mBigramScores, 0);
+        collectGarbage(mBigramSuggestions, PREF_MAX_BIGRAMS);
 
-            if (!TextUtils.isEmpty(prevWordForBigram)) {
-                CharSequence lowerPrevWord = prevWordForBigram.toString().toLowerCase();
-                if (mMainDict != null && mMainDict.isValidWord(lowerPrevWord)) {
-                    prevWordForBigram = lowerPrevWord;
-                }
-                for (final Dictionary dictionary : mBigramDictionaries.values()) {
-                    dictionary.getBigrams(sEmptyWordComposer, prevWordForBigram, this);
-                }
-                // Nothing entered: return all bigrams for the previous word
-                int insertCount = Math.min(mBigramSuggestions.size(), mPrefMaxSuggestions);
-                for (int i = 0; i < insertCount; ++i) {
-                    addBigramToSuggestions(mBigramSuggestions.get(i));
-                }
-            }
+        CharSequence lowerPrevWord = prevWordForBigram.toString().toLowerCase();
+        if (mMainDict != null && mMainDict.isValidWord(lowerPrevWord)) {
+            prevWordForBigram = lowerPrevWord;
+        }
+        for (final Dictionary dictionary : mBigramDictionaries.values()) {
+            dictionary.getBigrams(sEmptyWordComposer, prevWordForBigram, this);
+        }
+        // Nothing entered: return all bigrams for the previous word
+        int insertCount = Math.min(mBigramSuggestions.size(), mPrefMaxSuggestions);
+        for (int i = 0; i < insertCount; ++i) {
+            addBigramToSuggestions(mBigramSuggestions.get(i));
         }
 
         StringUtils.removeDupes(mSuggestions);
