diff -u -r old/sticky_notes.module new/sticky_notes.module
--- old/sticky_notes.module	2010-11-20 02:23:20.000000000 +0100
+++ new/sticky_notes.module	2010-12-01 13:15:33.000000000 +0100
@@ -566,16 +566,15 @@
   }
   
   $nodes = array();
-  $sql = 'SELECT    DISTINCT n.nid, n.uid, s.public
+  $sql = "SELECT    DISTINCT n.nid, n.uid, s.public,s.position_z
           FROM      {node} n
           LEFT JOIN {node_sticky_note} s USING(nid)
           WHERE     (
-                        s.link_path = "%s"
-                    OR  (s.link_scope = "pattern" AND s.link_pattern = "%s")
-                    OR  (s.link_scope = "all")
+                        s.link_path = '%s'
+                    OR  (s.link_scope = 'pattern' AND s.link_pattern = '%s')
+                    OR  (s.link_scope = 'all')
                     )
-          ' . $where . '
-          ORDER BY  s.position_z';
+          ".$where." ORDER BY  s.position_z";
   
   $result = db_query(db_rewrite_sql($sql, 'n', 'nid', $args), $args);
   
@@ -884,7 +883,7 @@
 
 function sticky_notes_reorder_page_notes($path, $pattern) {
   $zIndex = variable_get('sticky_notes_minimal_zindex', STICKY_NOTES_DEFAULT_ZINDEX);
-  $result = db_query('SELECT nid FROM {node_sticky_note} WHERE link_path = "%s" OR (link_scope = "pattern" AND link_pattern = "%s") ORDER BY position_z', $path, $pattern);
+  $result = db_query("SELECT nid FROM {node_sticky_note} WHERE link_path = '%s' OR (link_scope = 'pattern' AND link_pattern = '%s') ORDER BY position_z", $path, $pattern);
   while ($row = db_fetch_object($result)) {
     db_query('UPDATE {node_sticky_note} SET position_z = %d WHERE nid = %d', $zIndex++, $row->nid);
   }
