diff --git a/pd/src/g_scalar.c b/pd/src/g_scalar.c
index ab8315f153f899a2a8c84e6b24f7962f0e4d5f34..f035bcf1638ab7dd18056c05b390d24cda63bb88 100644
--- a/pd/src/g_scalar.c
+++ b/pd/src/g_scalar.c
@@ -846,13 +846,14 @@ int scalar_doclick(t_word *data, t_template *template, t_scalar *sc,
     if (xloc != 0.0 || yloc != 0.0)
     {
         //fprintf(stderr,"ignoring\n");
-        basex = 0.0;
-        basey = 0.0;
+        //basex = 0.0;
+        //basey = 0.0;
     }
 
-    hit = scalar_groupclick(templatecanvas, data, template, sc, ap,
-                owner, xloc, yloc, xpix, ypix,
-                shift, alt, dbl, doit, basex, basey);
+    if (templatecanvas)
+        hit = scalar_groupclick(templatecanvas, data, template, sc, ap,
+                    owner, xloc, yloc, xpix, ypix,
+                    shift, alt, dbl, doit, basex, basey);
     return hit;
 }