diff --git a/doc/1.manual/x5.htm b/doc/1.manual/x5.htm
index 45dd43c9b0a8917229c49763b52db147e0da81e9..671d967d92d7ab90a4ce75c2c4ee87d459cac7ec 100644
--- a/doc/1.manual/x5.htm
+++ b/doc/1.manual/x5.htm
@@ -20,6 +20,14 @@
 
 <H3> <A name="s2"> 5.1. release notes </A> </H3>
 
+<P> ------------------ 0.42.1 ---------------------------
+
+<P> Bug fix on Windows(cancelling window close deactivated window).
+
+<P> Bug fix running Pd from command line in MacOS.
+
+<P> "Select all" fixed to select none if everything already slected.
+
 <P> ------------------ 0.42 ---------------------------
 
 <P> The 'struct' object can now be used to catch a small but growing variety of
diff --git a/src/g_editor.c b/src/g_editor.c
index a012592832885a65d9b945390cb94aa0b5c32486..0fbce41a1b977c61f55cbb5b6978e15d41649311 100644
--- a/src/g_editor.c
+++ b/src/g_editor.c
@@ -1864,8 +1864,7 @@ void glob_verifyquit(void *dummy, t_floatarg f)
         return;
     }
     if (f == 0 && sys_perf)
-        sys_vgui("pdtk_check .x%lx {really quit?} {pd quit;\n} yes\n",
-            canvas_getrootfor(g2));
+        sys_vgui("pdtk_check . {really quit?} {pd quit;\n} yes\n");
     else glob_quit(0);
 }
 
@@ -2363,7 +2362,10 @@ static void canvas_selectall(t_canvas *x)
     t_gobj *y;
     if (!x->gl_edit)
         canvas_editmode(x, 1);
-    for (y = x->gl_list; y; y = y->g_next)
+            /* if everyone is already selected deselect everyone */
+    if (!glist_selectionindex(x, 0, 0))
+        glist_noselect(x);
+    else for (y = x->gl_list; y; y = y->g_next)
     {
         if (!glist_isselected(x, y))
             glist_select(x, y);
diff --git a/src/g_text.c b/src/g_text.c
index 30184fcfc4703f535f0290c3468eb1e69f76f3c4..b8680e87576b930706b710c311abb1a6c3930ca0 100644
--- a/src/g_text.c
+++ b/src/g_text.c
@@ -136,23 +136,39 @@ static void canvas_objtext(t_glist *gl, int xpix, int ypix, int selected,
 static void canvas_howputnew(t_canvas *x, int *connectp, int *xpixp, int *ypixp,
     int *indexp, int *totalp)
 {
-    int xpix, ypix, indx = 0, nobj = 0, x1, x2, y1, y2;
+    int xpix, ypix, indx = 0, nobj = 0, n2, x1, x2, y1, y2;
     int connectme = (x->gl_editor->e_selection &&
         !x->gl_editor->e_selection->sel_next);
     if (connectme)
     {
-        t_gobj *g;
+        t_gobj *g, *selected = x->gl_editor->e_selection->sel_what;
         for (g = x->gl_list, nobj = 0; g; g = g->g_next, nobj++)
-            if (g == x->gl_editor->e_selection->sel_what)
+            if (g == selected)
         {
             gobj_getrect(g, x, &x1, &y1, &x2, &y2);
             indx = nobj;
             *xpixp = x1;
             *ypixp = y2 + 5;
         }
+        glist_noselect(x);
+            /* search back for 'selected' and if it isn't on the list, 
+                plan just to connect from the last item on the list. */
+        for (g = x->gl_list, n2 = 0; g; g = g->g_next, n2++)
+        {
+            if (g == selected)
+            {
+                indx = n2;
+                break;
+            }
+            else if (!g->g_next)
+                indx = nobj-1;
+        }
+    }
+    else
+    {
+        glist_getnextxy(x, xpixp, ypixp);
+        glist_noselect(x);
     }
-    else glist_getnextxy(x, xpixp, ypixp);
-    glist_noselect(x);
     *connectp = connectme;
     *indexp = indx;
     *totalp = nobj;
diff --git a/src/t_tkcmd.c b/src/t_tkcmd.c
index 6d863c151db63e00dd09c26f62b009baee7f3247..b8cac71ef31bebfd1cd9d8c1c672843b9759e6b2 100644
--- a/src/t_tkcmd.c
+++ b/src/t_tkcmd.c
@@ -333,7 +333,7 @@ gotit: ;
 
 #ifdef STARTGUI
 
-#define DEBUGCONNECT
+/* #define DEBUGCONNECT */
 
 #ifdef DEBUGCONNECT
 static FILE *debugfd;
@@ -621,12 +621,26 @@ int Pdtcl_Init(Tcl_Interp *interp)
     int portno = 0, i;
     if (argv)
     {
+            /* search for arg of form "-guiport %d"; if so we're the
+            child. For some reason, the second version is too stringent
+            a test on MSW so the first, incorrect one, is conditionally
+            used. */
+#ifdef MSW
         for (i = 0; i < (int)strlen(argv) - 1; i++)
             if (argv[i] >= '0' && argv[i] <= '9')
         {
             portno = atoi(argv+i);
             break;
         }
+#else
+        for (i = 0; i < (int)strlen(argv) - 3; i++)
+            if (argv[i] == ' ' &&
+                argv[i+1] >= '0' && argv[i+1] <= '9')
+        {
+            portno = atoi(argv+i+1);
+            break;
+        }
+#endif
     }
     if (portno)
         pdgui_setsock(portno);
diff --git a/src/u_main.tk b/src/u_main.tk
index 394ae087581fd5844ff9f7081ea747345622c308..4a49d460422b3bde1979883911f1e74a4c488e78 100644
--- a/src/u_main.tk
+++ b/src/u_main.tk
@@ -283,8 +283,14 @@ proc pdtk_ping {} {
 
 ##### routine to ask user if OK and, if so, send a message on to Pd ######
 proc pdtk_check {canvas x message default} {
-    set answer [tk_messageBox -message $x -type yesno -default $default \
-        -parent $canvas -icon question]
+    global pd_nt
+    if {$pd_nt == 1} {
+        set answer [tk_messageBox -message $x -type yesno -default $default \
+            -icon question]
+    } else {
+        set answer [tk_messageBox -message $x -type yesno -default $default \
+            -parent $canvas -icon question]
+    }    
     if {! [string compare $answer yes]}  {pd $message}
 }