diff --git a/lib/tree.js b/lib/tree.js
index <HASH>..<HASH> 100644
--- a/lib/tree.js
+++ b/lib/tree.js
@@ -30,8 +30,18 @@ var _Tree = function( obj, tree ) {
       , i
       , len = self.length
       , repo = repo || self.repo
-      , event = new events.EventEmitter();
+      , event = new events.EventEmitter()
+      , prerequisites = 0;
 
+    function complete() {
+      if( i<len-1 ) {
+        next(i=i+1);
+      }
+      else {
+        event.emit( 'end' );
+      }
+    }
+    
     function next(i) {
       var dir;
       var tree;
@@ -45,19 +55,19 @@ var _Tree = function( obj, tree ) {
         else {
           dir = entry.name;
           tree = entry.tree();
+          prerequisites++;
 
           !tree.error && tree.walk( repo ).on( 'entry', function( i, entry ) {
             entry.dir += dir + '/';
             event.emit( 'entry', i, entry );
+          }).on( 'end' , function( ) {
+            prerequisites--;
+            
+            (prerequisites == 0) && event.emit( 'end' );
           });
         }
 
-        if( i<len-1 ) {
-          next(i=i+1);
-        }
-        else {
-          event.emit( 'end' );
-        }
+        (prerequisites == 0) && complete();
       });
     }
Fix Loading Issue in lib/tree.js

This code fixes a bug whereby some tree elements will not yet

have loaded when the 'end' event is signalled.