diff --git a/examples/chat.c b/examples/chat.c
index a236ce5f9efea83f2b926b6fc21e01c5eecab4d3..605e5d913dbd7f313feaccaab20e975505f44069 100644
--- a/examples/chat.c
+++ b/examples/chat.c
@@ -350,19 +350,24 @@ static enum mg_error_t process_request(struct mg_connection *conn,
 }
 
 int main(void) {
-  struct mg_context	*ctx;
+  struct mg_context *ctx;
+  struct mg_config config;
 
   // Initialize random number generator. It will be used later on for
   // the session identifier creation.
   srand((unsigned) time(0));
 
-  // Start and setup Mongoose
-  ctx = mg_start();
-  mg_set_option(ctx, "root", web_root);
-  mg_set_option(ctx, "ssl_cert", ssl_certificate);  // Must be set before ports
-  mg_set_option(ctx, "ports", http_ports);
-  mg_set_option(ctx, "dir_list", "no");   // Disable directory listing
-  mg_set_callback(ctx, MG_EVENT_NEW_REQUEST, &process_request);
+  // Setup and start Mongoose
+  memset(&config, 0, sizeof(config));
+  config.document_root = web_root;
+  config.listening_ports = http_ports;
+  config.ssl_certificate = ssl_certificate;
+  config.index_files = "index.html";
+  config.new_request_handler = &process_request;
+  config.auth_domain = "";
+  config.num_threads = "5";
+  ctx = mg_start(&config);
+  assert(ctx != NULL);
 
   // Wait until enter is pressed, then exit
   printf("Chat server started on ports %s, press enter to quit.\n", http_ports);
diff --git a/mongoose.c b/mongoose.c
index d7abd82e94ef94cf1a2491960a844451c49cade5..733e9606b6f59900d039c7bce04d520d6374aaf0 100644
--- a/mongoose.c
+++ b/mongoose.c
@@ -4300,7 +4300,7 @@ mg_start(struct mg_config *config)
 
 	/*
 	 * NOTE(lsm): order is important here. SSL certificates must
-	 * be initialized before listening ports.
+	 * be initialized before listening ports. UID must be set last.
 	 */
 	if (set_ssl_option(ctx) == MG_ERROR ||
 	    set_ports_option(ctx) == MG_ERROR ||
diff --git a/mongoose.h b/mongoose.h
index a33df485e1874356088e8c1ee71848ef2f9153b6..213c72de1171056e57a463eea8e5ed9fe8b2a82b 100644
--- a/mongoose.h
+++ b/mongoose.h
@@ -121,6 +121,7 @@ struct mg_config {
  * This must be the first function called by the application.
  * It creates a serving thread, and returns a context structure that
  * can be used to stop the server.
+ * After calling mg_start(), configuration data must not be changed.
  */
 struct mg_context *mg_start(struct mg_config *);