diff --git a/core/java/src/net/i2p/data/TunnelId.java b/core/java/src/net/i2p/data/TunnelId.java
index d058d63749b5ad06c017455c59a2766361c24c33..2188614ca59a56e33e457a823762abe2b04f81f5 100644
--- a/core/java/src/net/i2p/data/TunnelId.java
+++ b/core/java/src/net/i2p/data/TunnelId.java
@@ -18,6 +18,10 @@ import java.io.OutputStream;
  * the tunnel (otherwise they would get confused and send messages down the 
  * wrong one).
  *
+ * Note that a TunnelId must be greater than zero,
+ * as the DatabaseStoreMessage uses a zero ID to request
+ * a direct reply.
+ *
  * @author jrandom
  */
 public class TunnelId extends DataStructureImpl {
@@ -29,6 +33,10 @@ public class TunnelId extends DataStructureImpl {
         _tunnelId = -1;
     }
 
+    /**
+     *  @param id 1 to 0xffffffff
+     *  @throws IllegalArgumentException if less than or equal to zero
+     */
     public TunnelId(long id) { 
         if (id <= 0) throw new IllegalArgumentException("wtf, tunnelId " + id);
         _tunnelId = id;
@@ -36,6 +44,10 @@ public class TunnelId extends DataStructureImpl {
 
     public long getTunnelId() { return _tunnelId; }
 
+    /**
+     *  @param id 1 to 0xffffffff
+     *  @throws IllegalArgumentException if less than or equal to zero
+     */
     public void setTunnelId(long id) { 
         _tunnelId = id; 
         if (id <= 0) throw new IllegalArgumentException("wtf, tunnelId " + id);
diff --git a/router/java/src/net/i2p/router/tunnel/TunnelDispatcher.java b/router/java/src/net/i2p/router/tunnel/TunnelDispatcher.java
index 7e786016ceb69bed33052d5abdbf10918f5b9482..d24fd854e77511c081a620b426e69aadddf9cf8c 100644
--- a/router/java/src/net/i2p/router/tunnel/TunnelDispatcher.java
+++ b/router/java/src/net/i2p/router/tunnel/TunnelDispatcher.java
@@ -389,7 +389,7 @@ public class TunnelDispatcher implements Service {
         long rv;
         TunnelId tid;
         do {
-            rv = _context.random().nextLong(TunnelId.MAX_ID_VALUE);
+            rv = 1 + _context.random().nextLong(TunnelId.MAX_ID_VALUE - 1);
             tid = new TunnelId(rv);
         } while (_outboundGateways.containsKey(tid));
         return rv;
@@ -406,7 +406,7 @@ public class TunnelDispatcher implements Service {
         long rv;
         TunnelId tid;
         do {
-            rv = _context.random().nextLong(TunnelId.MAX_ID_VALUE);
+            rv = 1 + _context.random().nextLong(TunnelId.MAX_ID_VALUE - 1);
             tid = new TunnelId(rv);
         } while (_participants.containsKey(tid));
         return rv;
@@ -423,7 +423,7 @@ public class TunnelDispatcher implements Service {
         long rv;
         TunnelId tid;
         do {
-            rv = _context.random().nextLong(TunnelId.MAX_ID_VALUE);
+            rv = 1 + _context.random().nextLong(TunnelId.MAX_ID_VALUE - 1);
             tid = new TunnelId(rv);
         } while (_inboundGateways.containsKey(tid));
         return rv;
@@ -612,7 +612,7 @@ public class TunnelDispatcher implements Service {
      * endpoint.
      *
      * @param msg raw message to deliver to the target peer
-     * @param outboundTunnel tunnel to send the message out
+     * @param outboundTunnel tunnel to send the message out, or null for direct
      * @param targetPeer peer to receive the message
      */
     public void dispatchOutbound(I2NPMessage msg, TunnelId outboundTunnel, Hash targetPeer) {
@@ -626,7 +626,7 @@ public class TunnelDispatcher implements Service {
      *
      * @param msg raw message to deliver to the targetTunnel on the targetPeer
      * @param outboundTunnel tunnel to send the message out
-     * @param targetTunnel tunnel on the targetPeer to deliver the message to
+     * @param targetTunnel tunnel on the targetPeer to deliver the message to, or null for direct
      * @param targetPeer gateway to the tunnel to receive the message
      */
     public void dispatchOutbound(I2NPMessage msg, TunnelId outboundTunnel, TunnelId targetTunnel, Hash targetPeer) {
diff --git a/router/java/src/net/i2p/router/tunnel/pool/BuildRequestor.java b/router/java/src/net/i2p/router/tunnel/pool/BuildRequestor.java
index f2642b0c00d9aec0941db71fe2f02d3e82dadbd0..15c90b092ca21390e2ed24026097e25f5c173c69 100644
--- a/router/java/src/net/i2p/router/tunnel/pool/BuildRequestor.java
+++ b/router/java/src/net/i2p/router/tunnel/pool/BuildRequestor.java
@@ -81,7 +81,7 @@ abstract class BuildRequestor {
                 else if (isIB && i == len - 1)
                     id = ctx.tunnelDispatcher().getNewIBEPID();
                 else
-                    id = ctx.random().nextLong(TunnelId.MAX_ID_VALUE);
+                    id = 1 + ctx.random().nextLong(TunnelId.MAX_ID_VALUE - 1);
                 cfg.getConfig(i).setReceiveTunnelId(DataHelper.toLong(4, id));
             }