diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/executor/FetchFromIndexStep.java b/core/src/main/java/com/orientechnologies/orient/core/sql/executor/FetchFromIndexStep.java
index <HASH>..<HASH> 100755
--- a/core/src/main/java/com/orientechnologies/orient/core/sql/executor/FetchFromIndexStep.java
+++ b/core/src/main/java/com/orientechnologies/orient/core/sql/executor/FetchFromIndexStep.java
@@ -72,13 +72,14 @@ public class FetchFromIndexStep extends AbstractExecutionStep {
         }
         long begin = profilingEnabled ? System.nanoTime() : 0;
         try {
-          Map.Entry<Object, OIdentifiable> currentEntry = nextEntry;
+          Object key = nextEntry.getKey();
+          OIdentifiable value = nextEntry.getValue();
           fetchNextEntry();
 
           localCount++;
           OResultInternal result = new OResultInternal();
-          result.setProperty("key", currentEntry.getKey());
-          result.setProperty("rid", currentEntry.getValue());
+          result.setProperty("key", key);
+          result.setProperty("rid", value);
           ctx.setVariable("$current", result);
           return result;
         } finally {
Fix wrong key results on SELECT FROM index:x