diff --git a/pd/src/pd.tk b/pd/src/pd.tk
index 97322d2bf86c853aeb3b878f76a976d1d5b6bf90..a6893c8a57c8963292768b0f10bdd66a702aa088 100644
--- a/pd/src/pd.tk
+++ b/pd/src/pd.tk
@@ -1321,7 +1321,7 @@ proc open_file {filename} {
     if {[regexp -nocase -- "\.(pd|pat|mxt)$" $basename]} {
         pd "pd open [pdtk_enquote $basename] [pdtk_enquote $directory] ;"
         set pd_opendir $directory
-        ::pd_guiprefs::update_recentfiles $filename 1
+        ::pd_guiprefs::update_recentfiles "$filename" 1
     }
 }
 
@@ -3818,8 +3818,8 @@ proc pdtk_array_listview_new {id arrayName page} {
     toplevel $windowName -class [winfo class .]
 	wm geometry $windowName 220x400
 	wm minsize $windowName 220 400
-	#pdtk_standardkeybindings $windowName
-	bind $windowName <Control-w> {destroy %W}
+	# pdtk_standardkeybindings $windowName
+	bind $windowName <Control-w> [list destroy $windowName]
 	bind $windowName <Control-q> {menu_quit}
 	match_linux_wm [list $windowName configure]
     wm protocol $windowName WM_DELETE_WINDOW \
@@ -4964,7 +4964,7 @@ proc pdtk_canvas_saveas {name initfile initdir} {
     #       pd [concat $name savetofile $basename $directory \;]
     set untitled_directory $directory
     # add to recentfiles
-    ::pd_guiprefs::update_recentfiles $filename 1
+    ::pd_guiprefs::update_recentfiles "$filename" 1
 }
 
 # zooming (a subset of dofont)
diff --git a/pd/src/s_main.c b/pd/src/s_main.c
index 807fae30f31226bce4627056ff77bf3a73de6a47..531eb8ef69867226bdeb21ee9ad8ddd10da3a439 100644
--- a/pd/src/s_main.c
+++ b/pd/src/s_main.c
@@ -172,7 +172,7 @@ static void openit(const char *dirname, const char *filename)
     {
         close (fd);
         glob_evalfile(0, gensym(nameptr), gensym(dirbuf));
-        sys_vgui("pdtk_set_current_dir %s\n", filename);
+        sys_vgui("pdtk_set_current_dir {%s}\n", filename);
         char actualpath[PATH_MAX];
         char *path_ptr = NULL;
         path_ptr = realpath(filename, actualpath);
@@ -181,7 +181,7 @@ static void openit(const char *dirname, const char *filename)
         //    strstr(filename, dirname), actualpath, path_ptr);
         if (path_ptr != NULL)
         {
-            sys_vgui("::pd_guiprefs::update_recentfiles %s 1\n", actualpath);
+            sys_vgui("::pd_guiprefs::update_recentfiles \"%s\" 1\n", actualpath);
         }
     }
     else