diff --git a/lib/modules/Sql.pmod/pgsql.pike b/lib/modules/Sql.pmod/pgsql.pike
index 0dee6af78168ae1fa14068627f7d5048ded6a024..cb57aae436f55da203079d6b7a0237dc665c185d 100644
--- a/lib/modules/Sql.pmod/pgsql.pike
+++ b/lib/modules/Sql.pmod/pgsql.pike
@@ -618,11 +618,10 @@ final void _processloop(.pgsql_util.conxion ci) {
       if(_options && _options.reconnect)	// FIXME why can _options be 0?
         _connectfail();
       else
-        catch(destruct(waitforauthready));      // FIXME why can it be 0?
-      return;
-    }
-  }		      // Do not flush at this point, PostgreSQL 9.4 disapproves
-  procmessage();
+        destruct(waitforauthready);
+    } else	      // Do not flush at this point, PostgreSQL 9.4 disapproves
+      procmessage();
+  }
 }
 
 private void procmessage() {
@@ -1268,8 +1267,15 @@ private int reconnect() {
   _readyforquerycount=1;
   _waittocommit=0;
   qportals->write(1);
-  if(!(c=getsocket()))
-    ERROR("Couldn't connect to database on %s:%d\n",_host,_port);
+  if(!getsocket()) {
+    string msg=sprintf("Couldn't connect to database on %s:%d",_host,_port);
+    if(force) {
+      if(!sizeof(lastmessage) || lastmessage[sizeof(lastmessage)-1]!=msg)
+        lastmessage+=({msg});
+      return 0;
+    } else
+      ERROR(msg+"\n");
+  }
   _runtimeparameter=([]);
   _unnamedportalmux=Thread.Mutex();
   unnamedstatement=Thread.Mutex();
diff --git a/lib/modules/Sql.pmod/pgsql_util.pmod b/lib/modules/Sql.pmod/pgsql_util.pmod
index cf2d2862ec40132034e4c9994638f87f66c67702..de9bcb497635eeec469a0d021d5c1488eaf5f64b 100644
--- a/lib/modules/Sql.pmod/pgsql_util.pmod
+++ b/lib/modules/Sql.pmod/pgsql_util.pmod
@@ -208,7 +208,7 @@ class conxiin {
     PD("Read callback %O\n",(string)b);
     Thread.MutexKey lock=fillreadmux->lock();
     if(procmsg)
-      procmsg=0,lock=0,Thread.Thread(id);
+      procmsg=0,lock=0,Thread.Thread(id());
     else if(fillread)
       didreadcb=1, fillread.signal();
     lock=0;
@@ -355,10 +355,7 @@ outer:
   }
 
   protected void destroy() {
-    catch {			// Exceptions don't work inside destructors
-      close();
-      socket->set_callbacks();	// Clear all callbacks
-    };
+    catch(close());		// Exceptions don't work inside destructors
     connectfail=0;
   }
 
@@ -403,6 +400,7 @@ outer:
       socket->set_backend(local_backend);
       socket->set_buffer_mode(i,0);
       socket->set_nonblocking(i->read_cb,write_cb,close);
+      connectfail=pgsqlsess->_connectfail;
       Thread.Thread(pgsqlsess->_processloop,this);
       return;
     };