diff --git a/prev_next_views.module b/prev_next_views.module
index e24b11b..631515e 100644
--- a/prev_next_views.module
+++ b/prev_next_views.module
@@ -71,7 +71,7 @@ function prev_next_views_node_load($nodes, $types) {
     foreach ($nodes as $node) {
       if (array_search($node->nid, $_SESSION['prev_next_views']) === FALSE) {
         // The node being loaded is no longer part of the views results, so forget about it
-        unset($_SESSION['prev_next_views']);
+        //unset($_SESSION['prev_next_views']);
         break;
       }
     }
@@ -93,13 +93,13 @@ function prev_next_views_views_api() {
 /**
  * Implements hook_views_pre_execute().
  */
-function prev_next_views_views_pre_execute(&$view) {
+function prev_next_views_views_post_execute(&$view) {
   if (in_array($view->name, variable_get('prev_next_views_enabled', array()))) {
-    $result = $view->build_info['query']->execute();
+    $result = $view->result;
 
     $nids = array();
     foreach ($result as $item) {
-      $nids[] = $item->nid;
+      $nids[] = $item->entity;
     }
 
     $_SESSION['prev_next_views'] = $nids;
