diff --git a/pd/src/g_editor.c b/pd/src/g_editor.c
index e2e2c65ff6db5927d52c089940668473ee20579a..021f964e5026e6fc3877f1f995b1390f4f1169fa 100644
--- a/pd/src/g_editor.c
+++ b/pd/src/g_editor.c
@@ -6305,12 +6305,13 @@ static void canvas_dofancycopy(t_canvas *x, t_binbuf **object, t_binbuf **connec
     t_outconnect *oc;
     t_binbuf *b = binbuf_new();
     int maxx, maxy, minx, miny, numobj = 0;
-    maxx = maxy = 0;
-    minx = miny = INT_MAX;
 
     binbuf_addv(b, "ssiiiisi;", gensym("#N"), gensym("canvas"),
         0, 0, 450, 300, gensym("subpatch"), 0);
 
+    gobj_getrect(x->gl_editor->e_selection->sel_what, x,
+                    &minx, &miny, &maxx, &maxy);
+
     /* compute global rect */
     for (y = x->gl_list; y; y = y->g_next)
     {