diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java
index 30042d8..14b8143 100644
--- a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java
+++ b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java
@@ -254,9 +254,11 @@
                     startKeyRepeatTimer(REPEAT_INTERVAL, msg.arg1, tracker);
                     break;
                 }
-                case MSG_LONGPRESS_KEY:
-                    openPopupIfRequired(msg.arg1);
+                case MSG_LONGPRESS_KEY: {
+                    final PointerTracker tracker = (PointerTracker)msg.obj;
+                    openPopupIfRequired(msg.arg1, tracker);
                     break;
+                }
             }
         }
 
@@ -299,9 +301,9 @@
             return mInKeyRepeat;
         }
 
-        public void startLongPressTimer(int keyIndex, long delay) {
+        public void startLongPressTimer(long delay, int keyIndex, PointerTracker tracker) {
             removeMessages(MSG_LONGPRESS_KEY);
-            sendMessageDelayed(obtainMessage(MSG_LONGPRESS_KEY, keyIndex, 0), delay);
+            sendMessageDelayed(obtainMessage(MSG_LONGPRESS_KEY, keyIndex, 0, tracker), delay);
         }
 
         public void cancelLongPressTimer() {
@@ -962,16 +964,15 @@
                 key.x + key.width + getPaddingLeft(), key.y + key.height + getPaddingTop());
     }
 
-    private boolean openPopupIfRequired(int keyIndex) {
+    private boolean openPopupIfRequired(int keyIndex, PointerTracker tracker) {
         // Check if we have a popup layout specified first.
         if (mPopupLayout == 0) {
             return false;
         }
-        if (keyIndex < 0 || keyIndex >= mKeys.length) {
-            return false;
-        }
 
-        Key popupKey = mKeys[keyIndex];
+        Key popupKey = tracker.getKey(keyIndex);
+        if (popupKey == null)
+            return false;
         boolean result = onLongPress(popupKey);
         if (result) {
             dismissKeyPreview();
diff --git a/java/src/com/android/inputmethod/latin/PointerTracker.java b/java/src/com/android/inputmethod/latin/PointerTracker.java
index 10f51bd..f5f2c11 100644
--- a/java/src/com/android/inputmethod/latin/PointerTracker.java
+++ b/java/src/com/android/inputmethod/latin/PointerTracker.java
@@ -27,6 +27,7 @@
 public class PointerTracker {
     private static final String TAG = "PointerTracker";
     private static final boolean DEBUG = false;
+    private static final boolean DEBUG_MOVE = true && DEBUG;
 
     public interface UIProxy {
         public void invalidateKey(Key key);
@@ -155,12 +156,12 @@
                 repeatKey(keyIndex);
                 mHandler.startKeyRepeatTimer(REPEAT_START_DELAY, keyIndex, this);
             }
-            mHandler.startLongPressTimer(keyIndex, LONGPRESS_TIMEOUT);
+            mHandler.startLongPressTimer(LONGPRESS_TIMEOUT, keyIndex, this);
         }
         showKeyPreviewAndUpdateKey(keyIndex);
         updateMoveDebouncing(touchX, touchY);
         if (DEBUG)
-            Log.d(TAG, "onDownEvent: [" + mPointerId + "] modifier=" + isModifier());
+            debugLog("onDownEvent:", touchX, touchY);
     }
 
     public void onMoveEvent(int touchX, int touchY, long eventTime) {
@@ -169,7 +170,7 @@
             if (mCurrentKey == NOT_A_KEY) {
                 updateTimeDebouncing(eventTime);
                 mCurrentKey = keyIndex;
-                mHandler.startLongPressTimer(keyIndex, LONGPRESS_TIMEOUT);
+                mHandler.startLongPressTimer(LONGPRESS_TIMEOUT, keyIndex, this);
             } else if (isMinorMoveBounce(touchX, touchY, keyIndex, mCurrentKey)) {
                 updateTimeDebouncing(eventTime);
             } else {
@@ -177,7 +178,7 @@
                 resetTimeDebouncing(eventTime, mCurrentKey);
                 resetMoveDebouncing();
                 mCurrentKey = keyIndex;
-                mHandler.startLongPressTimer(keyIndex, LONGPRESS_TIMEOUT);
+                mHandler.startLongPressTimer(LONGPRESS_TIMEOUT, keyIndex, this);
             }
         } else {
             mHandler.cancelLongPressTimer();
@@ -190,11 +191,13 @@
          */
         showKeyPreviewAndUpdateKey(isMinorTimeBounce() ? mLastKey : mCurrentKey);
         updateMoveDebouncing(touchX, touchY);
+        if (DEBUG_MOVE)
+            debugLog("onMoveEvent:", touchX, touchY);
     }
 
     public void onUpEvent(int touchX, int touchY, long eventTime) {
         if (DEBUG)
-            Log.d(TAG, "onUpEvent: [" + mPointerId + "] modifier=" + isModifier());
+            debugLog("onUpEvent  :", touchX, touchY);
         int keyIndex = mKeyDetector.getKeyIndexAndNearbyCodes(touchX, touchY, null);
         boolean wasInKeyRepeat = mHandler.isInKeyRepeat();
         mHandler.cancelKeyTimers();
@@ -222,7 +225,7 @@
 
     public void onCancelEvent(int touchX, int touchY, long eventTime) {
         if (DEBUG)
-            Log.d(TAG, "onCancelEvent: [" + mPointerId + "]");
+            debugLog("onCancelEvt:", touchX, touchY);
         mHandler.cancelKeyTimers();
         mHandler.cancelPopupPreview();
         mProxy.dismissPopupKeyboard();
@@ -412,4 +415,18 @@
             resetMultiTap();
         }
     }
+
+    private void debugLog(String title, int x, int y) {
+        Key key = getKey(mCurrentKey);
+        final String code;
+        if (key == null) {
+            code = "----";
+        } else {
+            int primaryCode = key.codes[0];
+            code = String.format((primaryCode < 0) ? "%4d" : "0x%02x", primaryCode);
+        }
+         Log.d(TAG,
+                String.format("%s [%d] %d,%d %s %s", title, mPointerId, x, y, code,
+                        isModifier() ? "modifier" : ""));
+    }
 }
\ No newline at end of file
