diff --git a/sites/all/modules/wikitools/wikitools.admin.inc b/sites/all/modules/wikitools/wikitools.admin.inc
index 24cace0..868de23 100644
--- a/sites/all/modules/wikitools/wikitools.admin.inc
+++ b/sites/all/modules/wikitools/wikitools.admin.inc
@@ -151,12 +151,12 @@ function _wikitools_duplicate_nodes_query() {
     $n1_title = 'n1.title';
     $n2_title = 'n2.title';
     if (wikitools_treat_underscore_as_space()) {
-      $n1_title = 'REPLACE('. $n1_title .', "_", " ")';
-      $n2_title = 'REPLACE('. $n2_title .', "_", " ")';
+      $n1_title = "REPLACE($n1_title, '_', ' ')";
+      $n2_title = "REPLACE($n2_title, '_', ' ')";
     }
     if (wikitools_treat_dash_as_space()) {
-      $n1_title = 'REPLACE('. $n1_title .', "-", " ")';
-      $n2_title = 'REPLACE('. $n2_title .', "-", " ")';
+      $n1_title = "REPLACE($n1_title, '-', ' ')";
+      $n2_title = "REPLACE($n2_title, '-', ' ')";
     }
 
     // Grab all nodes that have the same title
