diff --git a/apps/i2psnark/java/src/org/klomp/snark/PeerCoordinator.java b/apps/i2psnark/java/src/org/klomp/snark/PeerCoordinator.java
index ba5597e591df2e27ad49d52c772e633c7aaf9a7f..2b517da8626eab40923e122c5bfa1accb6d03280 100644
--- a/apps/i2psnark/java/src/org/klomp/snark/PeerCoordinator.java
+++ b/apps/i2psnark/java/src/org/klomp/snark/PeerCoordinator.java
@@ -236,10 +236,21 @@ public class PeerCoordinator implements PeerListener
   {
     synchronized(peers)
       {
-        return !halted && peers.size() < _util.getMaxConnections();
+        return !halted && peers.size() < getMaxConnections();
       }
   }
   
+  /** reduce max if huge pieces to keep from ooming */
+  private int getMaxConnections() {
+    int size = metainfo.getPieceLength(0);
+    int max = _util.getMaxConnections();
+    if (size <= 1024*1024)
+      return max;
+    if (size <= 2*1024*1024)
+      return (max + 1) / 2;
+    return (max + 3) / 4;
+  }
+
   public boolean halted() { return halted; }
 
   public void halt()
@@ -294,7 +305,7 @@ public class PeerCoordinator implements PeerListener
             peer.disconnect(false); // Don't deregister this connection/peer.
           }
         // This is already checked in addPeer() but we could have gone over the limit since then
-        else if (peers.size() >= _util.getMaxConnections())
+        else if (peers.size() >= getMaxConnections())
           {
             if (_log.shouldLog(Log.WARN))
               _log.warn("Already at MAX_CONNECTIONS in connected() with peer: " + peer);
@@ -350,7 +361,7 @@ public class PeerCoordinator implements PeerListener
         peersize = peers.size();
         // This isn't a strict limit, as we may have several pending connections;
         // thus there is an additional check in connected()
-        need_more = (!peer.isConnected()) && peersize < _util.getMaxConnections();
+        need_more = (!peer.isConnected()) && peersize < getMaxConnections();
         // Check if we already have this peer before we build the connection
         Peer old = peerIDInList(peer.getPeerID(), peers);
         need_more = need_more && ((old == null) || (old.getInactiveTime() > 8*60*1000));
@@ -378,7 +389,7 @@ public class PeerCoordinator implements PeerListener
       if (peer.isConnected())
         _log.info("Add peer already connected: " + peer);
       else
-        _log.info("Connections: " + peersize + "/" + _util.getMaxConnections()
+        _log.info("Connections: " + peersize + "/" + getMaxConnections()
                   + " not accepting extra peer: " + peer);
     }
     return false;
diff --git a/apps/i2psnark/java/src/org/klomp/snark/SnarkManager.java b/apps/i2psnark/java/src/org/klomp/snark/SnarkManager.java
index f9470356b82db720480a1db21937939cdf349029..00f9d52be609afe02cca3175b3d2952749c69dc9 100644
--- a/apps/i2psnark/java/src/org/klomp/snark/SnarkManager.java
+++ b/apps/i2psnark/java/src/org/klomp/snark/SnarkManager.java
@@ -552,11 +552,15 @@ public class SnarkManager implements Snark.CompleteListener {
         List files = info.getFiles();
         if ( (files != null) && (files.size() > MAX_FILES_PER_TORRENT) ) {
             return "Too many files in " + info.getName() + " (" + files.size() + "), deleting it!";
+        } else if ( (files == null) && (info.getName().endsWith(".torrent")) ) {
+            return "Torrent file " + info.getName() + " cannot end in '.torrent', deleting it!";
         } else if (info.getPieces() <= 0) {
             return "No pieces in " + info.getName() + "?  deleting it!";
+        } else if (info.getPieces() > Storage.MAX_PIECES) {
+            return "Too many pieces in " + info.getName() + ", limit is " + Storage.MAX_PIECES + ", deleting it!";
         } else if (info.getPieceLength(0) > Storage.MAX_PIECE_SIZE) {
             return "Pieces are too large in " + info.getName() + " (" + DataHelper.formatSize(info.getPieceLength(0)) +
-                   "B), deleting it.";
+                   "B, limit is " + DataHelper.formatSize(Storage.MAX_PIECE_SIZE) + "B), deleting it.";
         } else if (info.getTotalLength() > Storage.MAX_TOTAL_SIZE) {
             System.out.println("torrent info: " + info.toString());
             List lengths = info.getLengths();
diff --git a/apps/i2psnark/java/src/org/klomp/snark/Storage.java b/apps/i2psnark/java/src/org/klomp/snark/Storage.java
index 85a470f4413764ce29f8ebac8b7a97f1f36cb0a6..cf3fcdc4b0bb9caaa01aa4951fffa5de84c2d5db 100644
--- a/apps/i2psnark/java/src/org/klomp/snark/Storage.java
+++ b/apps/i2psnark/java/src/org/klomp/snark/Storage.java
@@ -57,7 +57,8 @@ public class Storage
 
   /** The default piece size. */
   private static final int MIN_PIECE_SIZE = 256*1024;
-  public static final int MAX_PIECE_SIZE = 1024*1024;
+  /** note that we start reducing max number of peer connections above 1MB */
+  public static final int MAX_PIECE_SIZE = 2*1024*1024;
   /** The maximum number of pieces in a torrent. */
   public static final int MAX_PIECES = 10*1024;
   public static final long MAX_TOTAL_SIZE = MAX_PIECE_SIZE * (long) MAX_PIECES;