diff --git a/pd/nw/dialog_canvas.html b/pd/nw/dialog_canvas.html
index b57efc320ab825b9f3d583351a778c86db51ab95..6e3559ae424901a87d39a8d7c2fcab75eb96c31e 100644
--- a/pd/nw/dialog_canvas.html
+++ b/pd/nw/dialog_canvas.html
@@ -278,7 +278,7 @@
 
   <script>
 "use strict";
-var nw = require("nw.gui"); 
+var gui = require("nw.gui"); 
 var pdgui = require("./pdgui.js");
 
 // For translations
@@ -743,7 +743,7 @@ console.log("fungyfungyfungyfungy");
 
 function add_events(name) {
     // closing the Window
-    nw.Window.get().on("close", function() {
+    gui.Window.get().on("close", function() {
         // this needs to do whatever the "cancel" button does
         //pdgui.pdsend(name + " menuclose 0");
         //cancel();
diff --git a/pd/nw/dialog_font.html b/pd/nw/dialog_font.html
index e0580614297e47ea379217c6f58b5cc204e75fc6..a61b9634eca0fd4033214af16603aad16594bec1 100644
--- a/pd/nw/dialog_font.html
+++ b/pd/nw/dialog_font.html
@@ -94,7 +94,7 @@
 
   <script>
 "use strict";
-var nw = require("nw.gui"); 
+var gui = require("nw.gui"); 
 var pdgui = require("./pdgui.js");
 
 // For translations
@@ -181,7 +181,7 @@ function populate_form(attrs) {
 
 function add_events(name) {
     // closing the Window
-    nw.Window.get().on("close", function() {
+    gui.Window.get().on("close", function() {
         // this needs to do whatever the "cancel" button does
         //pdgui.pdsend(name, "menuclose 0");
         //cancel();
diff --git a/pd/nw/dialog_gatom.html b/pd/nw/dialog_gatom.html
index 9382d293af9021bc03ea835f6d6381556b1ca157..d76eeb2b593877124a19fe524bbae99d63c70731 100644
--- a/pd/nw/dialog_gatom.html
+++ b/pd/nw/dialog_gatom.html
@@ -137,7 +137,7 @@
 
   <script>
 "use strict";
-var nw = require("nw.gui"); 
+var gui = require("nw.gui"); 
 var pdgui = require("./pdgui.js");
 
 // For translations
@@ -270,7 +270,7 @@ function populate_form(attributes) {
 
 function add_events(name) {
     // closing the Window
-    nw.Window.get().on("close", function() {
+    gui.Window.get().on("close", function() {
         // this needs to do whatever the "cancel" button does
         //pdgui.pdsend(name, "menuclose 0");
         //cancel();
diff --git a/pd/nw/dialog_iemgui.html b/pd/nw/dialog_iemgui.html
index 93a8b9ac42cc858dbb1a4cd17c726169b56f123e..67e956ec8c1dc5eb9a59544d880f7e8158bb6cc1 100644
--- a/pd/nw/dialog_iemgui.html
+++ b/pd/nw/dialog_iemgui.html
@@ -299,7 +299,7 @@
 
   <script>
 "use strict";
-var nw = require("nw.gui"); 
+var gui = require("nw.gui"); 
 var pdgui = require("./pdgui.js");
 
 // For translations
@@ -555,7 +555,7 @@ function populate_form(attr_object) {
 
 function add_events(name) {
     // closing the Window
-    nw.Window.get().on("close", function() {
+    gui.Window.get().on("close", function() {
         // this needs to do whatever the "cancel" button does
         //pdgui.pdsend(name, "menuclose 0");
         //cancel();
diff --git a/pd/nw/dialog_prefs.html b/pd/nw/dialog_prefs.html
index 34e5a835ba1ad663bd9e2bd159b03ebd94e245e5..f63f7d98b6417e879f05a0af558c88536f689039 100644
--- a/pd/nw/dialog_prefs.html
+++ b/pd/nw/dialog_prefs.html
@@ -254,7 +254,7 @@
     </div>
   <script>
 "use strict";
-var nw = require("nw.gui"); 
+var gui = require("nw.gui"); 
 var pdgui = require("./pdgui.js");
 
 // For translations
@@ -633,7 +633,7 @@ function add_events(name) {
     // let's handle some events for this window...
 
     // closing the Window
-    nw.Window.get().on("close", function() {
+    gui.Window.get().on("close", function() {
         // this needs to do whatever the "cancel" button does
         pdgui.remove_dialogwin(pd_object_callback);
         this.close(true);