diff --git a/include/netinet/in.h b/include/netinet/in.h
index 7e7acf954075bda5503723cb327fe1b161ac5565..ef2b09a071136e5ef637f6dab15e7329cf3921ac 100644
--- a/include/netinet/in.h
+++ b/include/netinet/in.h
@@ -87,9 +87,9 @@ struct in_addr
 
 struct sockaddr_in
 {
-  sa_family_t sin_family;      /* address family: AF_INET */
-  uint16      sin_port;        /* port in network byte order */
-  struct in_addr sin_addr;   /* internet address */
+  sa_family_t sin_family;     /* Address family: AF_INET */
+  uint16      sin_port;       /* Port in network byte order */
+  struct in_addr sin_addr;    /* Internet address */
 };
 
 /* IPv6 Internet address */
@@ -106,9 +106,9 @@ struct in6_addr
 
 struct sockaddr_in6
 {
-  sa_family_t sin_family;      /* Address family: AF_INET */
-  uint16      sin_port;        /* Port in network byte order */
-  struct in6_addr sin6_addr; /* IPv6 internet address */
+  sa_family_t sin_family;     /* Address family: AF_INET */
+  uint16      sin_port;       /* Port in network byte order */
+  struct in6_addr sin6_addr;  /* IPv6 internet address */
 };
 
 /****************************************************************************
diff --git a/net/listen.c b/net/listen.c
index b4d519d9b7e24a27e4cc12e509ffa481cf35ed03..c28f9fae0f184a768f9f5d6821e6a72b4c10def3 100644
--- a/net/listen.c
+++ b/net/listen.c
@@ -1,7 +1,7 @@
 /****************************************************************************
  * net/listen.c
  *
- *   Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
+ *   Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
  *   Author: Gregory Nutt <spudmonkey@racsa.co.cr>
  *
  * Redistribution and use in source and binary forms, with or without
@@ -43,6 +43,7 @@
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <errno.h>
+#include <debug.h>
 
 #include "net_internal.h"
 
@@ -96,7 +97,7 @@ int listen(int sockfd, int backlog)
   if (!psock || psock->s_crefs <= 0)
     {
       /* It is not a valid socket description.  Distinguish between the cases
-       * where sockfd is a just valid and when it is a valid file descriptor used
+       * where sockfd is a just invalid and when it is a valid file descriptor used
        * in the wrong context.
        */
 
diff --git a/net/net_vfcntl.c b/net/net_vfcntl.c
index 0b228b212e51857b800211c89a9a3c1c51443306..88e46ad22a4547c31bbac4453751441d37c99a0b 100644
--- a/net/net_vfcntl.c
+++ b/net/net_vfcntl.c
@@ -125,7 +125,7 @@ int net_vfcntl(int sockfd, int cmd, va_list ap)
         {
           /* This summarizes the behavior of the NuttX/uIP sockets */
 
-	  ret = O_RDWR | O_SYNC | O_RSYNC;
+          ret = O_RDWR | O_SYNC | O_RSYNC;
 
           /* TCP/IP sockets may also be non-blocking if read-ahead is enabled */
 
@@ -158,11 +158,11 @@ int net_vfcntl(int sockfd, int cmd, va_list ap)
             {
                if ((mode & O_NONBLOCK) != 0)
                  {
-                   psock->s_type |= _SF_NONBLOCK;
+                   psock->s_flags |= _SF_NONBLOCK;
                  }
                else
                  {
-                   psock->s_type &= ~_SF_NONBLOCK;
+                   psock->s_flags &= ~_SF_NONBLOCK;
                  }
             }
 #endif
diff --git a/netutils/thttpd/libhttpd.c b/netutils/thttpd/libhttpd.c
index 32c147cac81d7d8eb33ae4e6d97f4dddbd68d09e..ad5091c1b7d14093dc15fc98986762a4bab81171 100644
--- a/netutils/thttpd/libhttpd.c
+++ b/netutils/thttpd/libhttpd.c
@@ -202,8 +202,12 @@ static int  check_referer(httpd_conn *hc);
 #ifdef CONFIG_THTTPD_URLPATTERN
 static int  really_check_referer(httpd_conn *hc);
 #endif
-static int  sockaddr_check(httpd_sockaddr * saP);
-static size_t sockaddr_len(httpd_sockaddr * saP);
+#ifdef CONFIG_DEBUG
+static int  sockaddr_check(httpd_sockaddr *saP);
+#else
+#  define sockaddr_check(saP) (1)
+#endif
+static size_t sockaddr_len(httpd_sockaddr *saP);
 
 /****************************************************************************
  * Private Data
@@ -295,11 +299,13 @@ static int initialize_listen_socket(httpd_sockaddr *saP)
 
   /* Check sockaddr. */
 
+#ifdef CONFIG_DEBUG
   if (!sockaddr_check(saP))
     {
       ndbg("unknown sockaddr family on listen socket\n");
       return -1;
     }
+#endif
 
   /* Create socket. */
 
@@ -321,7 +327,7 @@ static int initialize_listen_socket(httpd_sockaddr *saP)
 
   /* Bind to it. */
 
-  if (bind(listen_fd, (struct sockaddr*)&saP, sockaddr_len(saP)) < 0)
+  if (bind(listen_fd, (struct sockaddr*)saP, sockaddr_len(saP)) < 0)
     {
       ndbg("bind to %s failed: %d\n", httpd_ntoa(saP), errno);
       (void)close(listen_fd);
@@ -3293,7 +3299,8 @@ static int really_check_referer(httpd_conn *hc)
 }
 #endif
 
-static int sockaddr_check(httpd_sockaddr * saP)
+#ifdef CONFIG_DEBUG
+static int sockaddr_check(httpd_sockaddr *saP)
 {
   switch (saP->sin_family)
     {
@@ -3309,8 +3316,9 @@ static int sockaddr_check(httpd_sockaddr * saP)
       return 0;
     }
 }
+#endif
 
-static size_t sockaddr_len(httpd_sockaddr * saP)
+static size_t sockaddr_len(httpd_sockaddr *saP)
 {
   switch (saP->sin_family)
     {
@@ -3382,7 +3390,6 @@ FAR httpd_server *httpd_initialize(FAR httpd_sockaddr *sa, FAR const char *cwd)
       return NULL;
     }
 
-  nvdbg("Calling init_mime()\n");
   init_mime();
 
   /* Done initializing. */
@@ -3593,6 +3600,7 @@ int httpd_get_conn(httpd_server * hs, int listen_fd, httpd_conn *hc)
       return GC_FAIL;
     }
 
+#ifdef CONFIG_DEBUG
   if (!sockaddr_check(&sa))
     {
       ndbg("unknown sockaddr family\n");
@@ -3600,6 +3608,7 @@ int httpd_get_conn(httpd_server * hs, int listen_fd, httpd_conn *hc)
       hc->conn_fd = -1;
       return GC_FAIL;
     }
+#endif
 
   hc->hs = hs;
   (void)memset(&hc->client_addr, 0, sizeof(hc->client_addr));
diff --git a/netutils/thttpd/thttpd.c b/netutils/thttpd/thttpd.c
index aac9e4425d972b8d8ca508dc64192de7143b4b34..259f88e1b01ae14e459468d466df0a486893cf96 100644
--- a/netutils/thttpd/thttpd.c
+++ b/netutils/thttpd/thttpd.c
@@ -737,11 +737,7 @@ int thttpd_main(int argc, char **argv)
   int cnum;
   FAR struct connect_s *conn;
   FAR httpd_conn *hc;
-#ifdef  CONFIG_NET_IPv6
-  struct sockaddr_in6 sa;
-#else
-  struct sockaddr_in sa;
-#endif 
+  httpd_sockaddr sa;
   struct timeval tv;
 #ifdef CONFIG_THTTPD_DIR
   int ret;