diff --git a/node.php b/node.php
index bb195ce2fdde589d7053c92ff78cf32d4c773bb3..fa066e6b84e56bdb6032d381b97d5aae63e380fc 100644
--- a/node.php
+++ b/node.php
@@ -85,10 +85,10 @@ function node_history($node) {
   return $output;
 }
 
-$number = ($title ? db_result(db_query("SELECT COUNT(nid) FROM node WHERE title = '$title' AND status = $status[posted]")) : 1);
+$number = ($title ? db_num_row(db_query("SELECT nid FROM node WHERE title = '$title' AND status = $status[posted]")) : 1);
 
 if ($number > 1) {
-  $result = db_query("SELECT n.*, u.name, u.uid FROM node n LEFT JOIN user u ON n.author = u.uid WHERE n.title = '$title'");
+  $result = db_query("SELECT n.*, u.name, u.uid FROM node n LEFT JOIN user u ON n.author = u.uid WHERE n.title = '$title' AND n.status = $status[posted] ORDER BY timestamp DESC");
 
   while ($node = db_fetch_object($result)) {
     if (node_access($node)) {