diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyboardBuilder.java b/java/src/com/android/inputmethod/keyboard/internal/KeyboardBuilder.java
index dd31d17..613ce58 100644
--- a/java/src/com/android/inputmethod/keyboard/internal/KeyboardBuilder.java
+++ b/java/src/com/android/inputmethod/keyboard/internal/KeyboardBuilder.java
@@ -19,6 +19,7 @@
 import android.content.Context;
 import android.content.res.Resources;
 import android.content.res.TypedArray;
+import android.content.res.XmlResourceParser;
 import android.util.DisplayMetrics;
 import android.util.Log;
 import android.util.TypedValue;
@@ -268,14 +269,17 @@
 
     public KeyboardBuilder<KP> load(KeyboardId id) {
         mParams.mId = id;
+        final XmlResourceParser parser = mResources.getXml(id.getXmlId());
         try {
-            parseKeyboard(id.getXmlId());
+            parseKeyboard(parser);
         } catch (XmlPullParserException e) {
             Log.w(TAG, "keyboard XML parse error: " + e);
             throw new IllegalArgumentException(e);
         } catch (IOException e) {
             Log.w(TAG, "keyboard XML parse error: " + e);
             throw new RuntimeException(e);
+        } finally {
+            parser.close();
         }
         return this;
     }
@@ -288,9 +292,9 @@
         return new Keyboard(mParams);
     }
 
-    private void parseKeyboard(int resId) throws XmlPullParserException, IOException {
+    private void parseKeyboard(XmlResourceParser parser)
+            throws XmlPullParserException, IOException {
         if (DEBUG) Log.d(TAG, String.format("<%s> %s", TAG_KEYBOARD, mParams.mId));
-        final XmlPullParser parser = mResources.getXml(resId);
         int event;
         while ((event = parser.next()) != XmlPullParser.END_DOCUMENT) {
             if (event == XmlPullParser.START_TAG) {
@@ -535,7 +539,12 @@
                 throw new ParseException("No keyboardLayout attribute in <include/>", parser);
             if (DEBUG) Log.d(TAG, String.format("<%s keyboardLayout=%s />",
                     TAG_INCLUDE, mResources.getResourceEntryName(keyboardLayout)));
-            parseMerge(mResources.getLayout(keyboardLayout), row, skip);
+            final XmlResourceParser parserForInclude = mResources.getXml(keyboardLayout);
+            try {
+                parseMerge(parserForInclude, row, skip);
+            } finally {
+                parserForInclude.close();
+            }
         }
     }
 
diff --git a/java/src/com/android/inputmethod/latin/ComposingStateManager.java b/java/src/com/android/inputmethod/latin/ComposingStateManager.java
new file mode 100644
index 0000000..8811f20
--- /dev/null
+++ b/java/src/com/android/inputmethod/latin/ComposingStateManager.java
@@ -0,0 +1,68 @@
+/**
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.android.inputmethod.latin;
+
+import android.util.Log;
+
+public class ComposingStateManager {
+    private static final String TAG = ComposingStateManager.class.getSimpleName();
+    private static final ComposingStateManager sInstance = new ComposingStateManager();
+    private boolean mAutoCorrectionIndicatorOn;
+    private boolean mIsComposing;
+
+    public static ComposingStateManager getInstance() {
+        return sInstance;
+    }
+
+    private ComposingStateManager() {
+        mAutoCorrectionIndicatorOn = false;
+        mIsComposing = false;
+    }
+
+    public synchronized void onStartComposingText() {
+        if (!mIsComposing) {
+            if (LatinImeLogger.sDBG) {
+                Log.i(TAG, "Start composing text.");
+            }
+            mAutoCorrectionIndicatorOn = false;
+            mIsComposing = true;
+        }
+    }
+
+    public synchronized void onFinishComposingText() {
+        if (mIsComposing) {
+            if (LatinImeLogger.sDBG) {
+                Log.i(TAG, "Finish composing text.");
+            }
+            mAutoCorrectionIndicatorOn = false;
+            mIsComposing = false;
+        }
+    }
+
+    public synchronized boolean isAutoCorrectionIndicatorOn() {
+        return mAutoCorrectionIndicatorOn;
+    }
+
+    public synchronized void setAutoCorrectionIndicatorOn(boolean on) {
+        // Auto-correction indicator should be specified only when the current state is "composing".
+        if (!mIsComposing) return;
+        if (LatinImeLogger.sDBG) {
+            Log.i(TAG, "Set auto correction Indicator: " + on);
+        }
+        mAutoCorrectionIndicatorOn = on;
+    }
+}
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 517385c..2bd1735 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -230,7 +230,7 @@
     private CharSequence mEnteredText;
 
     private final ComposingStateManager mComposingStateManager =
-            new ComposingStateManager();
+            ComposingStateManager.getInstance();
 
     public final UIHandler mHandler = new UIHandler(this);
 
@@ -1635,6 +1635,10 @@
                     mComposingStateManager.isAutoCorrectionIndicatorOn();
             final boolean newAutoCorrectionIndicator = Utils.willAutoCorrect(words);
             if (oldAutoCorrectionIndicator != newAutoCorrectionIndicator) {
+                if (LatinImeLogger.sDBG) {
+                    Log.d(TAG, "Flip the indicator. " + oldAutoCorrectionIndicator
+                            + " -> " + newAutoCorrectionIndicator);
+                }
                 final CharSequence textWithUnderline = newAutoCorrectionIndicator
                         ? SuggestionSpanUtils.getTextWithAutoCorrectionIndicatorUnderline(
                                 this, mComposingStringBuilder)
@@ -2300,43 +2304,6 @@
         showOptionDialogInternal(builder.create());
     }
 
-    private static class ComposingStateManager {
-        private boolean mAutoCorrectionIndicatorOn;
-        private boolean mIsComposing;
-        public ComposingStateManager() {
-            mAutoCorrectionIndicatorOn = false;
-            mIsComposing = false;
-        }
-
-        private void onStartComposingText() {
-            if (!mIsComposing) {
-                if (LatinImeLogger.sDBG) {
-                    Log.i(TAG, "Start composing text.");
-                }
-                mAutoCorrectionIndicatorOn = false;
-                mIsComposing = true;
-            }
-        }
-
-        private void onFinishComposingText() {
-            if (mIsComposing) {
-                if (LatinImeLogger.sDBG) {
-                    Log.i(TAG, "Finish composing text.");
-                }
-                mAutoCorrectionIndicatorOn = false;
-                mIsComposing = false;
-            }
-        }
-
-        public boolean isAutoCorrectionIndicatorOn() {
-            return mAutoCorrectionIndicatorOn;
-        }
-
-        public void setAutoCorrectionIndicatorOn(boolean on) {
-            mAutoCorrectionIndicatorOn = on;
-        }
-    }
-
     @Override
     protected void dump(FileDescriptor fd, PrintWriter fout, String[] args) {
         super.dump(fd, fout, args);
