diff --git a/src/or/config.c b/src/or/config.c
index 3977d494e432621acf8a3522c1417ef084e7bfea..7a7be11369d4384e1eee2d91baa207d0cd26e5e2 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -218,6 +218,12 @@ RETURN VALUE: 0 on success, non-zero on error
       code = -1;
    }
 
+   if ( options->MaxConn >= MAXCONNECTIONS )
+   {
+      log(LOG_ERR,"MaxConn option must be less than %d.", MAXCONNECTIONS);
+      code = -1;
+   }
+
    if ( options->TrafficShaping != 0 && options->TrafficShaping != 1 )
    {
       log(LOG_ERR,"TrafficShaping option must be either 0 or 1.");
diff --git a/src/or/connection.c b/src/or/connection.c
index 1fa6779065577be510b07d62a400e9e9dd10c80a..a6acc003dda3abf82b7be614ddee372e23770dde 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -122,8 +122,10 @@ void connection_free(connection_t *conn) {
       crypto_free_cipher_env(conn->b_crypto);
   }
 
-  if(conn->s > 0)
+  if(conn->s > 0) {
+    log(LOG_INFO,"connection_free(): closing fd %d.",conn->s);
     close(conn->s);
+  }
   free(conn);
 }
 
@@ -156,11 +158,14 @@ int connection_create_listener(crypto_pk_env_t *prkey, struct sockaddr_in *local
   fcntl(s, F_SETFL, O_NONBLOCK); /* set s to non-blocking */
 
   conn = connection_new(type);
-  if(!conn)
+  if(!conn) {
+    log(LOG_DEBUG,"connection_create_listener(): connection_new failed. Giving up.");
     return -1;
+  }
   conn->s = s;
 
   if(connection_add(conn) < 0) { /* no space, forget it */
+    log(LOG_DEBUG,"connection_create_listener(): connection_add failed. Giving up.");
     connection_free(conn);
     return -1;
   }
@@ -192,7 +197,7 @@ int connection_handle_listener_read(connection_t *conn, int new_type, int new_st
     log(LOG_ERR,"connection_handle_listener_read(): accept() failed. Closing.");
     return -1;
   }
-  log(LOG_DEBUG,"Connection accepted on socket %d.",news);
+  log(LOG_INFO,"Connection accepted on socket %d (child of fd %d).",news, conn->s);
 
   fcntl(news, F_SETFL, O_NONBLOCK); /* set news to non-blocking */
 
@@ -211,7 +216,7 @@ int connection_handle_listener_read(connection_t *conn, int new_type, int new_st
 
   if(connection_add(newconn) < 0) { /* no space, forget it */
     connection_free(newconn);
-    return -1;
+    return 0; /* no need to tear down the parent */
   }
 
   log(LOG_DEBUG,"connection_handle_listener_read(): socket %d entered state %d.",newconn->s, new_state);
diff --git a/src/or/main.c b/src/or/main.c
index d1b49d05b004059e4a94c9999a2ef271c114b873..2b9fefa529df2bb38cc61cd707a389ca6360d5f0 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -36,8 +36,7 @@ static int rarray_len = 0;
 
 int connection_add(connection_t *conn) {
 
-  if(nfds >= MAXCONNECTIONS-2) { /* 2, for some breathing room. should count the fenceposts. */
-    /* FIXME should use the 'max connections' option */
+  if(nfds >= options.MaxConn-1) {
     log(LOG_INFO,"connection_add(): failing because nfds is too high.");
     return -1;
   }
@@ -55,7 +54,6 @@ int connection_add(connection_t *conn) {
   log(LOG_INFO,"connection_add(): new conn type %d, socket %d, nfds %d.",conn->type, conn->s, nfds);
 
   return 0;
-
 }
 
 void connection_set_poll_socket(connection_t *conn) {
@@ -73,7 +71,6 @@ int connection_remove(connection_t *conn) {
 
   current_index = conn->poll_index;
   if(current_index == nfds-1) { /* this is the end */
-//    connection_free(conn);
     nfds--;
     return 0;
   }