diff --git a/pd/src/g_template.c b/pd/src/g_template.c
index 8f7b9125a16bc8bb61c6982113692f25c6daaa4f..18c00948406442c5f6fb515fc8ab499c852c3126 100644
--- a/pd/src/g_template.c
+++ b/pd/src/g_template.c
@@ -1136,9 +1136,11 @@ void *svg_new(t_pd *parent, t_symbol *s, int argc, t_atom *argv)
             x->x_type == gensym("ellipse"))
         {
             nxy = 4;
+            if (argc > 4) argc = 4;
         }
         x->x_nargs = nxy;
     }
+    post("nxy is %d", nxy);
     x->x_vec = (t_fielddesc *)t_getbytes(nxy * sizeof(t_fielddesc));
     if (x->x_type == gensym("rect") ||
         x->x_type == gensym("circle") ||
@@ -1202,9 +1204,10 @@ void *svg_new(t_pd *parent, t_symbol *s, int argc, t_atom *argv)
 
     x->x_ndash = 0;
     x->x_strokedasharray =
-        (t_fielddesc *)t_getbytes(1 * sizeof(t_fielddesc));
+        (t_fielddesc *)t_getbytes(x->x_ndash * sizeof(t_fielddesc));
     x->x_transform_n = 0;
-    x->x_transform = (t_fielddesc *)t_getbytes(1 * sizeof(t_fielddesc));
+    x->x_transform = (t_fielddesc *)t_getbytes(x->x_transform_n *
+        sizeof(t_fielddesc));
     return (x);
 }