diff --git a/index.es6.js b/index.es6.js
index <HASH>..<HASH> 100644
--- a/index.es6.js
+++ b/index.es6.js
@@ -50,11 +50,11 @@ function shim(iter, root) {
       value: function () {
         let result = iter.nextNode();
         _pointerBeforeReferenceNode = false;
-        if (result !== null) {
-          _referenceNode = iter.nextNode();
-           return _referenceNode;
-        } else {
+        if (result === null) {
           return null;
+        } else {
+          _referenceNode = result;
+           return _referenceNode;
         }
       }
     },
@@ -63,11 +63,11 @@ function shim(iter, root) {
       value: function () {
         let result = iter.previousNode();
         _pointerBeforeReferenceNode = true;
-        if (result !== null) {
-          _referenceNode = iter.previousNode();
-           return _referenceNode;
-        } else {
+        if (result === null) {
            return null;
+        } else {
+          _referenceNode = result;
+           return _referenceNode;
         }
       }
     }
Positive assertions and correct code are good