diff --git a/pd/nw/dialog_data.html b/pd/nw/dialog_data.html
index 626930215d790724c8af1a9c42c75ac56d0bcc94..9f7b1ba5a932bb059a7ec7352d7c3067da78d1fc 100644
--- a/pd/nw/dialog_data.html
+++ b/pd/nw/dialog_data.html
@@ -62,7 +62,7 @@ function apply() {
     data_string += ";\n";
     // now tack on any vector data we may have
     if (vector_textarea) {
-        data_string += vector_textarea.textContent;
+        data_string += vector_textarea.value;
         // strip off the trailing semicolon. Otherwise Pd will crash...
         data_string = data_string.slice(0, -1);
     }
diff --git a/pd/src/g_readwrite.c b/pd/src/g_readwrite.c
index 8258f30763e94022f3aa88cda452af32f5806678..1b39cc6d5b8cb72c0d15d74cb0ee4e17c39826b4 100644
--- a/pd/src/g_readwrite.c
+++ b/pd/src/g_readwrite.c
@@ -341,8 +341,17 @@ void canvas_dataproperties(t_canvas *x, t_scalar *sc, t_binbuf *b)
         && (template = template_findbyname(((t_scalar *)newone)->sc_template)))
     {
             /* copy new one to old one and delete new one */
-        memcpy(&((t_scalar *)oldone)->sc_vec, &((t_scalar *)newone)->sc_vec,
-            template->t_n * sizeof(t_word));
+        int i;
+        /* swap out the sc_vec field. That way we'll keep the one from
+           the new scalar, and the old one will get freed by word_free (which
+           gets called from pd_free below)
+        */
+        for (i = 0; i < template->t_n; i++)
+        {
+            t_word w = ((t_scalar *)newone)->sc_vec[i];
+            ((t_scalar *)newone)->sc_vec[i] = ((t_scalar *)oldone)->sc_vec[i];
+            ((t_scalar *)oldone)->sc_vec[i] = w;
+        }
         pd_free(&newone->g_pd);
         if (glist_isvisible(x))
         {