diff --git a/connection.cpp b/connection.cpp
index 15f6067..a961831 100644
--- a/connection.cpp
+++ b/connection.cpp
@@ -160,7 +160,7 @@ DBconn *DBconn::InitConnection(const std::wstring &connectString)
 			);
 	}
 
-	if (!ms_primaryConn)
+	if (ms_primaryConn->m_conn == NULL)
 	{
 		std::wstring error = ms_primaryConn->GetLastError();
 		delete ms_primaryConn;
diff --git a/pgAgent.cpp b/pgAgent.cpp
index 6928e4d..36b3835 100644
--- a/pgAgent.cpp
+++ b/pgAgent.cpp
@@ -207,7 +207,7 @@ void MainLoop()
 			MainRestartLoop(serviceConn);
 		}
 
-		LogMessage((boost::wformat(L"Couldn't create the primary connection (attempt %d): %s") % attemptCount % serviceConn->GetLastError()).str(), LOG_STARTUP);
+		LogMessage((boost::wformat(L"Couldn't create the primary connection [Attempt #%d]") % attemptCount).str(), LOG_STARTUP);
 
 		DBconn::ClearConnections(true);
 
