diff --git a/lib/modules/Sql.pmod/pgsql.pike b/lib/modules/Sql.pmod/pgsql.pike
index cff8ae537529b867bb3d080c8bdaa98400f153f7..4fc0c6c424f816abd95f73d192267444d875af7d 100644
--- a/lib/modules/Sql.pmod/pgsql.pike
+++ b/lib/modules/Sql.pmod/pgsql.pike
@@ -5,8 +5,8 @@
 //! This is an interface to the PostgreSQL database
 //! server. This module is independent of any external libraries.
 //! Note that you @b{do not@} need to have a
-//! PostgreSQL server running on your host to use this module: you can
-//! connect to the database over a TCP/IP socket.
+//! PostgreSQL server running on @b{your@} host to use this module: you can
+//! connect to the database over a TCP/IP socket on a different host.
 //!
 //! This module replaces the functionality of the older @[Sql.postgres]
 //! and @[Postgres.postgres] modules.
@@ -1193,9 +1193,11 @@ private void procmessage() {
       }
     };				// We only get here if there is an error
     if(err==MAGICTERMINATE) {	// Announce connection termination to server
-      object cs = ci->start();
-      CHAIN(cs)->add("X\0\0\0\4");
-      cs->sendcmd(SENDOUT);
+      catch {
+        object cs = ci->start();
+        CHAIN(cs)->add("X\0\0\0\4");
+        cs->sendcmd(SENDOUT);
+      };
       terminating=1;
       err=0;
     } else if(stringp(err)) {
diff --git a/lib/modules/Sql.pmod/pgsql_util.pmod b/lib/modules/Sql.pmod/pgsql_util.pmod
index 713073f8c22b81ac1091e67bae040d5b11e980ab..7c33a8272d3c9f73b51f40b69c53c8d84cfb1692 100644
--- a/lib/modules/Sql.pmod/pgsql_util.pmod
+++ b/lib/modules/Sql.pmod/pgsql_util.pmod
@@ -200,7 +200,7 @@ class bufcon {
       if (mode == SYNCSEND) {
         add(PGSYNC);
         realbuffer->stashqueue->write(1);
-        mode = SENDOUT;
+        mode = SENDOUT;	    // Demote it to prevent an extra SYNC upon stashflush
       }
     }
     realbuffer->stash->add(this);