diff --git a/src/com/android/inputmethod/latin/CandidateView.java b/src/com/android/inputmethod/latin/CandidateView.java
index 08c68dc..f397363 100755
--- a/src/com/android/inputmethod/latin/CandidateView.java
+++ b/src/com/android/inputmethod/latin/CandidateView.java
@@ -148,16 +148,17 @@
             @Override
             public boolean onScroll(MotionEvent e1, MotionEvent e2,
                     float distanceX, float distanceY) {
+                final int width = getWidth();
                 mScrolled = true;
-                mScrollX += distanceX;
+                mScrollX += (int) distanceX;
                 if (mScrollX < 0) {
                     mScrollX = 0;
                 }
-                if (mScrollX + getWidth() > mTotalWidth) {                    
-                    mScrollX -= distanceX;
+                if (distanceX > 0 && mScrollX + width > mTotalWidth) {                    
+                    mScrollX -= (int) distanceX;
                 }
                 mTargetScrollX = mScrollX;
-                showPreview(OUT_OF_BOUNDS, null);
+                hidePreview();
                 invalidate();
                 return true;
             }
@@ -236,7 +237,8 @@
 
             mWordX[i] = x;
 
-            if (touchX + scrollX >= x && touchX + scrollX < x + wordWidth && !scrolled) {
+            if (touchX + scrollX >= x && touchX + scrollX < x + wordWidth && !scrolled &&
+                    touchX != OUT_OF_BOUNDS) {
                 if (canvas != null) {
                     canvas.translate(x, 0);
                     mSelectionHighlight.setBounds(0, bgPadding.top, wordWidth, height);
@@ -399,7 +401,7 @@
             mSelectedString = null;
             mSelectedIndex = -1;
             removeHighlight();
-            showPreview(OUT_OF_BOUNDS, null);
+            hidePreview();
             requestLayout();
             break;
         }
@@ -425,16 +427,21 @@
         mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_REMOVE_THROUGH_PREVIEW), 200);
     }
 
+    private void hidePreview() {
+        mCurrentWordIndex = OUT_OF_BOUNDS;
+        if (mPreviewPopup.isShowing()) {
+            mHandler.sendMessageDelayed(mHandler
+                    .obtainMessage(MSG_REMOVE_PREVIEW), 60);
+        }
+    }
+    
     private void showPreview(int wordIndex, String altText) {
         int oldWordIndex = mCurrentWordIndex;
         mCurrentWordIndex = wordIndex;
         // If index changed or changing text
         if (oldWordIndex != mCurrentWordIndex || altText != null) {
             if (wordIndex == OUT_OF_BOUNDS) {
-                if (mPreviewPopup.isShowing()) {
-                    mHandler.sendMessageDelayed(mHandler
-                            .obtainMessage(MSG_REMOVE_PREVIEW), 60);
-                }
+                hidePreview();
             } else {
                 CharSequence word = altText != null? altText : mSuggestions.get(wordIndex);
                 mPreviewText.setText(word);
@@ -475,4 +482,10 @@
             showPreview(0, getContext().getResources().getString(R.string.added_word, word));
         }
     }
+    
+    @Override
+    public void onDetachedFromWindow() {
+        super.onDetachedFromWindow();
+        hidePreview();
+    }
 }
