diff --git a/pd/src/g_scalar.c b/pd/src/g_scalar.c
index 6f828b893d7b1a65a650171ea55e36726f3ee1f6..738acee7a36101228e7fcabbb121c4cc334495cc 100644
--- a/pd/src/g_scalar.c
+++ b/pd/src/g_scalar.c
@@ -188,7 +188,7 @@ static void scalar_getrect(t_gobj *z, t_glist *owner,
         if (x2 < x1 || y2 < y1)
             x1 = y1 = x2 = y2 = 0;
     }
-    /* post("scalar x1 %d y1 %d x2 %d y2 %d", x1, y1, x2, y2); */
+    //fprintf(stderr,"scalar x1 %d y1 %d x2 %d y2 %d\n", x1, y1, x2, y2);
     *xp1 = x1;
     *yp1 = y1;
     *xp2 = x2;
@@ -237,8 +237,13 @@ static void scalar_select(t_gobj *z, t_glist *owner, int state)
 		sys_vgui(".x%lx.c addtag selected withtag scalar%lx\n",
 			glist_getcanvas(owner), x);
 		if (templatecanvas) {
+			// get the universal tag for all nested objects
+			t_canvas *tag = owner;
+			while (tag->gl_owner) {
+				tag = tag->gl_owner;
+			}
 			sys_vgui(".x%lx.c addtag selected withtag %lx\n",
-				glist_getcanvas(owner), x->sc_vec);
+				glist_getcanvas(owner), (t_int)tag);
 		}
 	} else {
 		sys_vgui(".x%lx.c dtag scalar%lx selected\n",
@@ -422,7 +427,7 @@ int scalar_doclick(t_word *data, t_template *template, t_scalar *sc,
 static int scalar_click(t_gobj *z, struct _glist *owner,
     int xpix, int ypix, int shift, int alt, int dbl, int doit)
 {
-	//fprintf(stderr,"scalar_click\n");
+	fprintf(stderr,"scalar_click\n");
     t_scalar *x = (t_scalar *)z;
     t_template *template = template_findbyname(x->sc_template);
     return (scalar_doclick(x->sc_vec, template, x, 0,
diff --git a/pd/src/g_template.c b/pd/src/g_template.c
index fe530530f71d34ce19b9fc9cd63238d52746f1c7..90e91be17a91d3c08feaa2eb6734d6bc70d68aa2 100644
--- a/pd/src/g_template.c
+++ b/pd/src/g_template.c
@@ -1045,6 +1045,7 @@ static void curve_getrect(t_gobj *z, t_glist *glist,
     t_word *data, t_template *template, t_float basex, t_float basey,
     int *xp1, int *yp1, int *xp2, int *yp2)
 {
+	//fprintf(stderr,"curve_getrect\n");
     t_curve *x = (t_curve *)z;
     int i, n = x->x_npoints;
     t_fielddesc *f = x->x_vec;
@@ -1130,6 +1131,12 @@ static void curve_vis(t_gobj *z, t_glist *glist,
     t_curve *x = (t_curve *)z;
     int i, n = x->x_npoints;
     t_fielddesc *f = x->x_vec;
+
+	// get the universal tag for all nested objects
+	t_canvas *tag = x->x_canvas;
+	while (tag->gl_owner) {
+		tag = tag->gl_owner;
+	}
     
         /* see comment in plot_vis() */
     if (vis && !fielddesc_getfloat(&x->x_vis, template, data, 0))
@@ -1176,7 +1183,7 @@ static void curve_vis(t_gobj *z, t_glist *glist,
             else sys_vgui("-fill %s\\\n", outline);
             if (flags & BEZ) sys_vgui("-smooth 1\\\n");
             sys_vgui("-tags {.x%lx.x%lx.curve%lx %lx}\n", glist_getcanvas(glist), glist,
-				data, data);
+				data, (t_int)tag);
         }
         else post("warning: curves need at least two points to be graphed");
     }
@@ -1651,7 +1658,14 @@ static void plot_vis(t_gobj *z, t_glist *glist,
     int tovis)
 {
     t_plot *x = (t_plot *)z;
-	//fprintf(stderr,"plot %lx glist %lx glist_getcanvas %lx plot->x_obj %lx plot->x_canvas %lx\n", (t_int)x, (t_int)glist, (t_int)glist_getcanvas(glist), (t_int)&x->x_obj, (t_int)x->x_canvas);
+
+	// get the universal tag for all nested objects
+	t_canvas *tag = x->x_canvas;
+	while (tag->gl_owner) {
+		tag = tag->gl_owner;
+	}
+
+	//fprintf(stderr,"===============plot %lx glist %lx glist_getcanvas %lx plot->x_obj %lx plot->x_canvas %lx glist_getcanvas(plot->x_canvas) %lx\n", (t_int)x, (t_int)glist, (t_int)glist_getcanvas(glist), (t_int)&x->x_obj, (t_int)x->x_canvas, (t_int)x->x_canvas->gl_owner);
     int elemsize, yonset, wonset, xonset, i;
     t_canvas *elemtemplatecanvas;
     t_template *elemtemplate;
@@ -1722,14 +1736,14 @@ static void plot_vis(t_gobj *z, t_glist *glist,
                 {
 					//we subtract 1 from y to keep it in sync with the rest of the types of templates
                     sys_vgui(
-".x%lx.c create rectangle %d %d %d %d -fill black -width 0  -tags .x%lx.x%lx.plot%lx\n",
+".x%lx.c create rectangle %d %d %d %d -fill black -width 0  -tags {.x%lx.x%lx.plot%lx %lx}\n",
                         glist_getcanvas(glist),
                         ixpix, (int)glist_ytopixels(glist, 
                             basey + fielddesc_cvttocoord(yfielddesc, minyval)) - 1,
                         inextx, (int)(glist_ytopixels(glist, 
                             basey + fielddesc_cvttocoord(yfielddesc, maxyval))
                                 + linewidth) - 1, glist_getcanvas(glist), glist,
-						 data);
+						 data, (t_int)tag);
                     ndrawn++;
                     minyval = 1e20;
                     maxyval = -1e20;
@@ -1822,8 +1836,8 @@ static void plot_vis(t_gobj *z, t_glist *glist,
                     outline, outline);
                 if (style == PLOTSTYLE_BEZ) sys_vgui("-smooth 1\\\n");
 
-                sys_vgui("-tags .x%lx.x%lx.plot%lx\n", glist_getcanvas(glist), glist,
-					 data);
+                sys_vgui("-tags {.x%lx.x%lx.plot%lx %lx}\n", glist_getcanvas(glist), glist,
+					 data, (t_int)tag);
             }
             else if (linewidth > 0)
             {
@@ -1866,7 +1880,7 @@ static void plot_vis(t_gobj *z, t_glist *glist,
                 sys_vgui("-fill %s\\\n", outline);
                 if (style == PLOTSTYLE_BEZ) sys_vgui("-smooth 1\\\n");
 
-                sys_vgui("-tags .x%lx.x%lx.plot%lx\n", glist_getcanvas(glist), glist, data);
+                sys_vgui("-tags {.x%lx.x%lx.plot%lx %lx}\n", glist_getcanvas(glist), glist, data, (t_int)tag);
             }
         }
             /* We're done with the outline; now draw all the points.
@@ -2129,6 +2143,12 @@ static void drawnumber_vis(t_gobj *z, t_glist *glist,
 {
 	//fprintf(stderr,"drawnumber_vis %d\n", vis);
     t_drawnumber *x = (t_drawnumber *)z;
+
+	// get the universal tag for all nested objects
+	t_canvas *tag = x->x_canvas;
+	while (tag->gl_owner) {
+		tag = tag->gl_owner;
+	}
     
         /* see comment in plot_vis() */
     if (vis && !fielddesc_getfloat(&x->x_vis, template, data, 0))
@@ -2154,7 +2174,7 @@ static void drawnumber_vis(t_gobj *z, t_glist *glist,
         sys_vgui(" -font {{%s} -%d %s}", sys_font,
 				 sys_hostfontsize(fontsize), sys_fontweight);
         sys_vgui(" -tags {.x%lx.x%lx.drawnumber%lx %lx}\n", 
-			glist_getcanvas(glist), glist, data, data);
+			glist_getcanvas(glist), glist, data, (t_int)tag);
     }
     else sys_vgui(".x%lx.c delete .x%lx.x%lx.drawnumber%lx\n", glist_getcanvas(glist), 
 		glist_getcanvas(glist), glist, data);
@@ -2488,6 +2508,12 @@ static void drawsymbol_vis(t_gobj *z, t_glist *glist,
     int vis)
 {
     t_drawsymbol *x = (t_drawsymbol *)z;
+
+	// get the universal tag for all nested objects
+	t_canvas *tag = x->x_canvas;
+	while (tag->gl_owner) {
+		tag = tag->gl_owner;
+	}
     
         /* see comment in plot_vis() */
     if (vis && !fielddesc_getfloat(&x->x_vis, template, data, 0))
@@ -2513,7 +2539,7 @@ static void drawsymbol_vis(t_gobj *z, t_glist *glist,
         sys_vgui(" -font {{%s} -%d %s}", sys_font,
 				 sys_hostfontsize(fontsize), sys_fontweight);
         sys_vgui(" -tags {.x%lx.x%lx.drawsymbol%lx %lx}\n", 
-			glist_getcanvas(glist), glist, data, data);
+			glist_getcanvas(glist), glist, data, (t_int)tag);
     }
     else sys_vgui(".x%lx.c delete .x%lx.x%lx.drawsymbol%lx\n", glist_getcanvas(glist), 
 		glist_getcanvas(glist), glist, data);