Index: function.c
==================================================================
--- function.c
+++ function.c
@@ -366,10 +366,12 @@
   for(i=0;i<info->nConstraint;i++) {
     if((info->aConstraint[i].iColumn==-1 || !info->aConstraint[i].iColumn) && info->aConstraint[i].op==SQLITE_INDEX_CONSTRAINT_EQ && info->aConstraint[i].usable) {
       info->aConstraintUsage[i].argvIndex=1;
       info->aConstraintUsage[i].omit=1;
       info->idxFlags=SQLITE_INDEX_SCAN_UNIQUE;
+      info->estimatedCost=1.0;
+      info->estimatedRows=1;
       break;
     }
   }
   return SQLITE_OK;
 }
@@ -636,11 +638,11 @@
         }
         if(objects[cur->rowid]) break;
       }
     }
     cur->arg[1]=1;
-  } else if((cur->arg[0]&0x0006) && !cur->arg[1]) {
+  } else if((cur->arg[0]&0x0066) && !cur->arg[1]) {
     // Find top/bottom at location
     cur->arg[1]=1;
     atxy:
     cur->rowid=playfield[cur->arg[2]+cur->arg[3]*64-65];
     if(cur->rowid==VOIDLINK) goto nextxy;
@@ -783,11 +785,11 @@
           info->idxFlags=SQLITE_INDEX_SCAN_UNIQUE;
           sqlite3_str_appendchar(str,1,'a');
           info->estimatedCost/=10000.0;
         } else if(j==SQLITE_INDEX_CONSTRAINT_GT || j==SQLITE_INDEX_CONSTRAINT_GE) {
           info->idxNum|=0x0008;
-          info->aConstraintUsage[i].omit=1;
+          //info->aConstraintUsage[i].omit=1;
           info->aConstraintUsage[i].argvIndex=++arg;
           sqlite3_str_appendchar(str,1,j==SQLITE_INDEX_CONSTRAINT_GT?'b':'c');
           info->estimatedCost/=1200.0;
         }
         break;