--- node_privacy_byrole.module-orig	2005-09-07 18:58:43.000000000 -0500
+++ node_privacy_byrole.module	2005-09-07 19:01:09.000000000 -0500
@@ -457,7 +457,8 @@
     // We use the delete statement to avoid inserting a duplicate entry into the database.
     // Without the DELETE query, this can happen when a site admin has already enabled the modules
     // from the settings page and goes back to it and resaves the enabled setting.
-    db_query('REPLACE INTO {node_access} VALUES (0, 0, \'all\', 1, 0, 0)');
+    db_query("DELETE FROM {node_access} WHERE nid = 0 AND gid = 0 AND realm = 'all'");
+    db_query("INSERT INTO {node_access} VALUES (0, 0, 'all', 1, 0, 0)");
   }
   else { // the module was just enabled; provide default view access to everyone for nodes that were created
          // between the previous disabling of the module and the current enabling of the module;
@@ -484,4 +485,4 @@
   }
 }
 
-?>
\ No newline at end of file
+?>
