--- casetracker.module.orig	2007-08-02 13:55:56.000000000 +0200
+++ casetracker.module	2007-08-02 13:57:00.000000000 +0200
@@ -921,8 +921,10 @@
           return $block;
         } break;
       case 1:
-        $results = db_query_range(db_rewrite_sql("SELECT n.*, cs.* FROM {node} n INNER JOIN {casetracker_case} cs ON (n.vid = cs.vid) WHERE n.status = 1 ORDER BY n.created DESC"), 0, variable_get('casetracker_block_latest_cases_count', 5));
-        $cases = array(); while ($case_result = db_fetch_object($results)) { // we'll pull up the raw case data and the raw project data and send it right to the theme.
+        $query = db_rewrite_sql("SELECT n.nid, n.*, cs.* FROM {node} n INNER JOIN {casetracker_case} cs ON (n.vid = cs.vid) WHERE n.status = 1 ORDER BY n.created DESC");
+        $results = db_query_range($query, 0, variable_get('casetracker_block_latest_cases_count', 5));
+        $cases = array();
+        while ($case_result = db_fetch_object($results)) { // we'll pull up the raw case data and the raw project data and send it right to the theme.
           $project_result = db_fetch_object(db_query("SELECT n.*, cp.* FROM {node} n INNER JOIN {casetracker_project} cp ON (n.vid = cp.vid) WHERE n.nid = %d", $case_result->pid));
           $cases[] = array('case' => $case_result, 'project' => $project_result);
         }
