diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 23ebc11..2ba98e2 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -2170,8 +2170,10 @@ include 'filename'
         processes). The default is zero, meaning replication is
         disabled. WAL sender processes count towards the total number
         of connections, so the parameter cannot be set higher than
-        <xref linkend="guc-max-connections">.  This parameter can only
-        be set at server start. <varname>wal_level</> must be set
+        <xref linkend="guc-max-connections">. Like
+        <xref linkend="guc-superuser-reserved-connections"> this option reserves
+        connections from <xref linkend="guc-max-connections">. This parameter
+        can only be set at server start. <varname>wal_level</> must be set
         to <literal>archive</> or <literal>hot_standby</> to allow
         connections from standby servers.
        </para>
diff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/postinit.c
index 2c7f0f1..3194894 100644
--- a/src/backend/utils/init/postinit.c
+++ b/src/backend/utils/init/postinit.c
@@ -436,7 +436,7 @@ InitializeMaxBackends(void)
 
 	/* the extra unit accounts for the autovacuum launcher */
 	MaxBackends = MaxConnections + autovacuum_max_workers + 1 +
-		+ max_worker_processes;
+		+ max_worker_processes + max_wal_senders;
 
 	/* internal error because the values were all checked previously */
 	if (MaxBackends > MAX_BACKENDS)
@@ -705,7 +705,7 @@ InitPostgres(const char *in_dbname, Oid dboid, const char *username,
 	 * don't allow them to consume the reserved slots, which are intended for
 	 * interactive use.
 	 */
-	if ((!am_superuser || am_walsender) &&
+	if ((!am_superuser && !am_walsender) &&
 		ReservedBackends > 0 &&
 		!HaveNFreeProcs(ReservedBackends))
 		ereport(FATAL,
