diff --git a/ndnProtocol/components/ndnProtocolService.js b/ndnProtocol/components/ndnProtocolService.js
index 8f58a45..4541231 100644
--- a/ndnProtocol/components/ndnProtocolService.js
+++ b/ndnProtocol/components/ndnProtocolService.js
@@ -134,6 +134,7 @@
     this.finalSegmentNumber = null;
     this.didOnStart = false;
     this.uriEndsWithSegmentNumber = endsWithSegmentNumber(uriName);
+    this.nameWithoutSegment = null;
 };
 
 ContentClosure.prototype.upcall = function(kind, upcallInfo) {
@@ -173,26 +174,25 @@
     // If !this.uriEndsWithSegmentNumber, we use the segmentNumber to load multiple segments.
     // If this.uriEndsWithSegmentNumber, then we leave segmentNumber null.
     var segmentNumber = null;
-    if (!this.uriEndsWithSegmentNumber && endsWithSegmentNumber(contentObject.name)) {
+    if (!this.uriEndsWithSegmentNumber && endsWithSegmentNumber(contentObject.name))
         segmentNumber = DataUtils.bigEndianToUnsignedInt
             (contentObject.name.components[contentObject.name.components.length - 1]);
-        this.segmentStore.storeContent(segmentNumber, contentObject);
-    }
     
     if ((segmentNumber == null || segmentNumber == 0) && !this.didOnStart) {
         // This is the first or only segment.
-        /* TODO: Finish implementing check for META.
+        /*
         var iMetaComponent = getIndexOfMetaComponent(contentObject.name);
         if (!this.uriEndsWithSegmentNumber && iMetaComponent >= 0 &&
             getIndexOfMetaComponent(this.uriName) < 0) {
-            // The matched content name has a META component that wasn't requiested in the original
-            //   URI.  Try to exclude the META component to get the "real" content.
+            // The matched content name has a META component that wasn't requested in the original
+            //   URI.  Add this to the excluded META components to try to get the "real" content.
             var nameWithoutMeta = new Name(contentObject.name.components.slice(0, iMetaComponent));
             var excludeMetaTemplate = this.segmentTemplate.clone();
-            excludeMetaTemplate.exclude = new Exclude([MetaComponentPrefix, Exclude.ANY]);
+            excludeMetaTemplate.exclude = new Exclude([contentObject.name.components[iMetaComponent]]);
             
             this.ndn.expressInterest
                 (nameWithoutMeta, new ExponentialReExpressClosure(this), excludeMetaTemplate);
+            return Closure.RESULT_OK;
         }
         */
         
@@ -215,24 +215,39 @@
         var ioService = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
         this.contentListener.onStart(contentTypeEtc.contentType, contentTypeEtc.contentCharset, 
             ioService.newURI(contentUriSpec, this.aURI.originCharset, null));
-    }
 
-    if (segmentNumber == null) {
-        // We are not doing segments, so just finish.
-        this.contentListener.onReceivedContent(DataUtils.toString(contentObject.content));
-        this.contentSha256.update(contentObject.content);
-        this.contentListener.onStop();
+        if (segmentNumber == null) {
+            // We are not doing segments, so just finish.
+            this.contentListener.onReceivedContent(DataUtils.toString(contentObject.content));
+            this.contentSha256.update(contentObject.content);
+            this.contentListener.onStop();
 
-        if (!this.uriEndsWithSegmentNumber) {
-            var nameContentDigest = contentObject.name.getContentDigestValue();
-            if (nameContentDigest != null &&
-                !DataUtils.arraysEqual(nameContentDigest, this.contentSha256.finalize()))
-                // TODO: How to show the user an error for invalid digest?
-                dump("Content does not match digest in name " + contentObject.name.to_uri());
+            if (!this.uriEndsWithSegmentNumber) {
+                var nameContentDigest = contentObject.name.getContentDigestValue();
+                if (nameContentDigest != null &&
+                    !DataUtils.arraysEqual(nameContentDigest, this.contentSha256.finalize()))
+                    // TODO: How to show the user an error for invalid digest?
+                    dump("Content does not match digest in name " + contentObject.name.to_uri());
+            }
+            return Closure.RESULT_OK;
         }
-        return Closure.RESULT_OK;
+        else
+            // We are doing segments.  Make sure we always request the same base name.
+            this.nameWithoutSegment = new Name(contentObject.name.components.slice
+                (0, contentObject.name.components.length - 1));
     }
     
+    if (segmentNumber == null)
+        // We should be doing segments at this point.
+        return Closure.RESULT_ERR;
+    
+    if (!(contentObject.name.components.length == this.nameWithoutSegment.components.length + 1 &&
+          this.nameWithoutSegment.match(contentObject.name)))
+        // The content object name is not part of our sequence of segments.
+        return Closure.RESULT_ERR;
+    
+    this.segmentStore.storeContent(segmentNumber, contentObject);
+
     if (contentObject.signedInfo != null && contentObject.signedInfo.finalBlockID != null)
         this.finalSegmentNumber = DataUtils.bigEndianToUnsignedInt(contentObject.signedInfo.finalBlockID);
 
@@ -260,14 +275,11 @@
     if (this.finalSegmentNumber == null && !this.didRequestFinalSegment) {
         this.didRequestFinalSegment = true;
         // Try to determine the final segment now.
-        var components = contentObject.name.components.slice
-            (0, contentObject.name.components.length - 1);
-            
         // Clone the template to set the childSelector.
         var childSelectorTemplate = this.segmentTemplate.clone();
         childSelectorTemplate.childSelector = 1;
         this.ndn.expressInterest
-            (new Name(components), new ExponentialReExpressClosure(this), childSelectorTemplate);
+            (this.nameWithoutSegment, new ExponentialReExpressClosure(this), childSelectorTemplate);
     }
 
     // Request new segments.
@@ -277,8 +289,7 @@
             continue;
         
         this.ndn.expressInterest
-            (new Name(contentObject.name.components.slice
-                      (0, contentObject.name.components.length - 1)).addSegment(toRequest[i]), 
+            (new Name(this.nameWithoutSegment).addSegment(toRequest[i]), 
              new ExponentialReExpressClosure(this), this.segmentTemplate);
     }
         
