diff --git a/src/vnet/session/application_interface.c b/src/vnet/session/application_interface.c
index 566a52d..8dbc3a1 100644
--- a/src/vnet/session/application_interface.c
+++ b/src/vnet/session/application_interface.c
@@ -207,11 +207,22 @@
   return 0;
 }
 
+static u8 *cache_uri;
+static session_type_t cache_sst;
+static transport_endpoint_t *cache_tep;
+
 int
 parse_uri (char *uri, session_type_t * sst, transport_endpoint_t * tep)
 {
   unformat_input_t _input, *input = &_input;
 
+  if (cache_uri && !strncmp (uri, (char *) cache_uri, vec_len (cache_uri)))
+    {
+      *sst = cache_sst;
+      *tep = *cache_tep;
+      return 0;
+    }
+
   /* Make sure */
   uri = (char *) format (0, "%s%c", uri, 0);
 
@@ -224,6 +235,14 @@
     }
   unformat_free (input);
 
+  vec_free (cache_uri);
+  cache_uri = (u8 *) uri;
+  cache_sst = *sst;
+  if (cache_tep)
+    clib_mem_free (cache_tep);
+  cache_tep = clib_mem_alloc (sizeof (*tep));
+  *cache_tep = *tep;
+
   return 0;
 }
 
diff --git a/src/vnet/session/session.c b/src/vnet/session/session.c
index dcd141f..17644e2 100644
--- a/src/vnet/session/session.c
+++ b/src/vnet/session/session.c
@@ -889,32 +889,24 @@
     session_vpp_event_queue_allocate (smm, i);
 
   /* Preallocate sessions */
-  if (num_threads == 1)
+  if (smm->preallocated_sessions)
     {
-      for (i = 0; i < smm->preallocated_sessions; i++)
+      if (num_threads == 1)
 	{
-	  stream_session_t *ss __attribute__ ((unused));
-	  pool_get_aligned (smm->sessions[0], ss, CLIB_CACHE_LINE_BYTES);
+	  pool_init_fixed (smm->sessions[0], smm->preallocated_sessions);
 	}
-
-      for (i = 0; i < smm->preallocated_sessions; i++)
-	pool_put_index (smm->sessions[0], i);
-    }
-  else
-    {
-      int j;
-      preallocated_sessions_per_worker = smm->preallocated_sessions /
-	(num_threads - 1);
-
-      for (j = 1; j < num_threads; j++)
+      else
 	{
-	  for (i = 0; i < preallocated_sessions_per_worker; i++)
+	  int j;
+	  preallocated_sessions_per_worker =
+	    (1.1 * (f64) smm->preallocated_sessions /
+	     (f64) (num_threads - 1));
+
+	  for (j = 1; j < num_threads; j++)
 	    {
-	      stream_session_t *ss __attribute__ ((unused));
-	      pool_get_aligned (smm->sessions[j], ss, CLIB_CACHE_LINE_BYTES);
+	      pool_init_fixed (smm->sessions[j],
+			       preallocated_sessions_per_worker);
 	    }
-	  for (i = 0; i < preallocated_sessions_per_worker; i++)
-	    pool_put_index (smm->sessions[j], i);
 	}
     }
 
diff --git a/src/vnet/session/session_cli.c b/src/vnet/session/session_cli.c
index 028dc9d..d9f516b 100755
--- a/src/vnet/session/session_cli.c
+++ b/src/vnet/session/session_cli.c
@@ -115,8 +115,8 @@
     {
       *proto = TRANSPORT_PROTO_UDP;
     }
-  else if (unformat (input, "%U:%d->%U:%d", unformat_ip4_address, &lcl->ip4,
-		     lcl_port, unformat_ip4_address, &rmt->ip4, rmt_port))
+  if (unformat (input, "%U:%d->%U:%d", unformat_ip4_address, &lcl->ip4,
+		lcl_port, unformat_ip4_address, &rmt->ip4, rmt_port))
     {
       *is_ip4 = 1;
       tuple_is_set = 1;
diff --git a/src/vnet/tcp/tcp.c b/src/vnet/tcp/tcp.c
index 0a826a5..a4c1308 100644
--- a/src/vnet/tcp/tcp.c
+++ b/src/vnet/tcp/tcp.c
@@ -1150,6 +1150,10 @@
   else
     {
       tc = tcp_connection_get (conn_index, vlib_get_thread_index ());
+      /* note: the connection may have already disappeared */
+      if (PREDICT_FALSE (tc == 0))
+	return;
+
       ASSERT (tc->state == TCP_STATE_SYN_RCVD);
     }
   tc->timers[TCP_TIMER_ESTABLISH] = TCP_TIMER_HANDLE_INVALID;
@@ -1244,7 +1248,7 @@
   vlib_thread_main_t *vtm = vlib_get_thread_main ();
   clib_error_t *error = 0;
   u32 num_threads;
-  int i, thread;
+  int thread;
   tcp_connection_t *tc __attribute__ ((unused));
   u32 preallocated_connections_per_thread;
 
@@ -1297,21 +1301,17 @@
     }
   for (; thread < num_threads; thread++)
     {
-      for (i = 0; i < preallocated_connections_per_thread; i++)
-	pool_get (tm->connections[thread], tc);
-
-      for (i = 0; i < preallocated_connections_per_thread; i++)
-	pool_put_index (tm->connections[thread], i);
+      if (preallocated_connections_per_thread)
+	pool_init_fixed (tm->connections[thread],
+			 preallocated_connections_per_thread);
     }
 
   /*
-   * Preallocate half-open connections
+   * Use a preallocated half-open connection pool?
    */
-  for (i = 0; i < tm->preallocated_half_open_connections; i++)
-    pool_get (tm->half_open_connections, tc);
-
-  for (i = 0; i < tm->preallocated_half_open_connections; i++)
-    pool_put_index (tm->half_open_connections, i);
+  if (tm->preallocated_half_open_connections)
+    pool_init_fixed (tm->half_open_connections,
+		     tm->preallocated_half_open_connections);
 
   /* Initialize per worker thread tx buffers (used for control messages) */
   vec_validate (tm->tx_buffers, num_threads - 1);
diff --git a/src/vnet/tcp/tcp_output.c b/src/vnet/tcp/tcp_output.c
index 0255551..15a9dcb 100644
--- a/src/vnet/tcp/tcp_output.c
+++ b/src/vnet/tcp/tcp_output.c
@@ -440,13 +440,16 @@
 always_inline int
 tcp_alloc_tx_buffers (tcp_main_t * tm, u8 thread_index, u32 n_free_buffers)
 {
+  u32 current_length = vec_len (tm->tx_buffers[thread_index]);
+
   vec_validate (tm->tx_buffers[thread_index],
-		vec_len (tm->tx_buffers[thread_index]) + n_free_buffers - 1);
+		current_length + n_free_buffers - 1);
   _vec_len (tm->tx_buffers[thread_index]) =
-    vlib_buffer_alloc_from_free_list (vlib_get_main (),
-				      tm->tx_buffers[thread_index],
-				      n_free_buffers,
-				      VLIB_BUFFER_DEFAULT_FREE_LIST_INDEX);
+    current_length + vlib_buffer_alloc_from_free_list (vlib_get_main (),
+						       tm->tx_buffers
+						       [thread_index],
+						       n_free_buffers,
+						       VLIB_BUFFER_DEFAULT_FREE_LIST_INDEX);
   /* buffer shortage, report failure */
   if (vec_len (tm->tx_buffers[thread_index]) == 0)
     {
@@ -1293,11 +1296,17 @@
   if (is_syn)
     {
       tc = tcp_half_open_connection_get (index);
+      /* Note: the connection may have transitioned to ESTABLISHED... */
+      if (PREDICT_FALSE (tc == 0))
+	return;
       tc->timers[TCP_TIMER_RETRANSMIT_SYN] = TCP_TIMER_HANDLE_INVALID;
     }
   else
     {
       tc = tcp_connection_get (index, thread_index);
+      /* Note: the connection may have been closed and pool_put */
+      if (PREDICT_FALSE (tc == 0))
+	return;
       tc->timers[TCP_TIMER_RETRANSMIT] = TCP_TIMER_HANDLE_INVALID;
     }
 
@@ -1332,25 +1341,27 @@
 
       TCP_EVT_DBG (TCP_EVT_CC_EVT, tc, 1);
 
-      /* Send one segment */
+      /* Send one segment. Note that n_bytes may be zero due to buffer shortfall  */
       n_bytes = tcp_prepare_retransmit_segment (tc, 0, tc->snd_mss, &b);
-      ASSERT (n_bytes);
-      bi = vlib_get_buffer_index (vm, b);
+
       /* TODO be less aggressive about this */
       scoreboard_clear (&tc->sack_sb);
 
       if (n_bytes == 0)
 	{
-	  clib_warning ("could not retransmit anything");
-	  clib_warning ("%U", format_tcp_connection, tc, 2);
-
+	  if (b)
+	    {
+	      clib_warning ("retransmit fail: %U", format_tcp_connection, tc,
+			    2);
+	      ASSERT (tc->rto_boff > 1 && tc->snd_una == tc->snd_congestion);
+	    }
 	  /* Try again eventually */
 	  tcp_retransmit_timer_set (tc);
-	  ASSERT (0 || (tc->rto_boff > 1
-			&& tc->snd_una == tc->snd_congestion));
 	  return;
 	}
 
+      bi = vlib_get_buffer_index (vm, b);
+
       /* For first retransmit, record timestamp (Eifel detection RFC3522) */
       if (tc->rto_boff == 1)
 	tc->snd_rxt_ts = tcp_time_now ();
@@ -1378,7 +1389,10 @@
 	tc->rto = clib_min (tc->rto << 1, TCP_RTO_MAX);
 
       if (PREDICT_FALSE (tcp_get_free_buffer_index (tm, &bi)))
-	return;
+	{
+	  clib_warning ("tcp_get_free_buffer_index FAIL");
+	  return;
+	}
       b = vlib_get_buffer (vm, bi);
       tcp_init_buffer (vm, b);
       tcp_push_hdr_i (tc, b, tc->state, 1);
