              return None
  
 -        return defer.maybeDeferred(self._getChild, None, self.site.resource, segments, updatepaths=False)
-+        def _registerResource(child):
-+            self._resourcesByURL[child] = path
-+            self._urlsByResource[path] = child
-+            return child
-+        
 +        d = defer.maybeDeferred(self._getChild, None, self.site.resource, segments, updatepaths=False)
-+        d.addCallback(_registerResource)
++        d.addCallback(self._rememberResource, path)
++        d.addErrback(notFound)
 +        return d
  
 +    def locateChildResource(self, res, childpath):

 
     def unparseURL(self, scheme=None, host=None, port=None,
                    path=None, params=None, querystring=None, fragment=None):
@@ -263,8 +280,15 @@
             failedDeferred = self._processingFailed(failure.Failure())
             return
         
+        def _registerResource(child):
+            url = "/" + "/".join(self.prepath)
+            self._resourcesByURL[child] = url
+            self._urlsByResource[url] = child
+            return child
+        
         d = defer.Deferred()
         d.addCallback(self._getChild, self.site.resource, self.postpath)
+        d.addCallback(_registerResource)
         d.addCallback(lambda res, req: res.renderHTTP(req), self)
         d.addCallback(self._cbFinishRender)
         d.addErrback(self._processingFailed)
@@ -320,8 +344,6 @@
                     url = "/" + "/".join(path)
                 else:
                     url = "/"

+                return f
+            return None
+
+        d = defer.maybeDeferred(self._getChild, None, res, [segment], updatepaths=False)
+        d.addCallback(self._rememberResource, url)
+        d.addErrback(notFound)
+        return d
+
     def _processingFailed(self, reason):
