diff --git a/pd/nw/pdgui.js b/pd/nw/pdgui.js
index 40bdd2082cfc56e119932bb7a3c657519466ad42..84766a9a0358e2085a52658d344b161f79f5325f 100644
--- a/pd/nw/pdgui.js
+++ b/pd/nw/pdgui.js
@@ -2768,6 +2768,15 @@ function gui_drawimage_new(obj_tag, file_path, canvasdir, flags) {
     }
 }
 
+function gui_drawimage_free(obj_tag) {
+    if (drawimage_data[obj_tag] && drawimage_data[obj_tag].length) {
+        post("drawimage: freed " + drawimage_data[obj_tag].length + " images");
+        drawimage_data[obj_tag] = []; // empty the image(s)
+    } else {
+        post("drawimage: warning: no image data to free");
+    }
+}
+
 function img_size_setter(cid, obj, obj_tag, i) {
     var img = new pd_window.window.Image(),
         w, h;
diff --git a/pd/src/g_template.c b/pd/src/g_template.c
index 6a0cd3de75ba22fae0447f07f0c3023a10d076b1..bc12b34ca39842b70d1dcdf176fb76054828897c 100644
--- a/pd/src/g_template.c
+++ b/pd/src/g_template.c
@@ -6106,8 +6106,9 @@ static void plot_vis(t_gobj *z, t_glist *glist, t_glist *parentglist,
         }
 
         /* make sure the array drawings are behind the graph */
-        sys_vgui(".x%lx.c lower plot%lx graph%lx\n", glist_getcanvas(glist),
-            data, glist);
+        /* not doing this yet with the GUI port... */
+        //sys_vgui(".x%lx.c lower plot%lx graph%lx\n", glist_getcanvas(glist),
+        //    data, glist);
 
             /* We're done with the outline; now draw all the points.
             This code is inefficient since the template has to be
@@ -7541,8 +7542,13 @@ static void drawimage_vis(t_gobj *z, t_glist *glist, t_glist *parentglist,
         svg_togui(svg, template, data);
         gui_end_vmess();
     }
-    else sys_vgui("pdtk_drawimage_unvis .x%lx.c .x%lx.i\n",
-        glist_getcanvas(glist), data);
+    else
+    {
+        /* We don't actually need this-- the image should get destroyed
+           automatically. */
+        //sys_vgui("pdtk_drawimage_unvis .x%lx.c .x%lx.i\n",
+        //    glist_getcanvas(glist), data);
+    }
 }
 
 static t_float drawimage_motion_ycumulative;
@@ -7718,7 +7724,8 @@ static void drawimage_free(t_drawimage *x)
     //sprintf(buf, ".x%lx", (t_int)x);
     sprintf(buf, ".x%lx", (long unsigned int)x);
     pd_unbind(&x->x_obj.ob_pd, gensym(buf));
-    sys_vgui("pdtk_drawimage_free .x%lx\n", (t_int)x);
+    //sys_vgui("pdtk_drawimage_free .x%lx\n", (t_int)x);
+    gui_vmess("gui_drawimage_free", "x", x);
 }
 
 static void drawimage_setup(void)