 // MARK: - NSOutlineViewDataSource
 extension FileOutlineView {
 
+  fileprivate func scanChildrenIfNecessary(_ fileBrowserItem: FileBroswerItem) {
+    guard fileBrowserItem.isChildrenScanned == false else {
+      return
+    }
+
+    fileBrowserItem.children = self.sortedChildren(of: fileBrowserItem.url)
+    fileBrowserItem.isChildrenScanned = true
+  }
+
   fileprivate func prepare(_ children: [FileBrowserItem]) -> [FileBrowserItem] {
     return self.isShowHidden ? children : children.filter { !$0.url.isHidden }
   }
 
   func outlineView(_: NSOutlineView, numberOfChildrenOfItem item: Any?) -> Int {
     if item == nil {
-      if self.root.isChildrenScanned == false {
-        self.root.children = self.sortedChildren(of: self.cwd)
-        self.root.isChildrenScanned = true
-      }
+      self.scanChildrenIfNecessary(self.root)
 
       return self.prepare(self.root.children).count
     }


    self.handleRemovals(for: fileBrowserItem, new: newChildren)
    self.handleAdditions(for: fileBrowserItem, new: newChildren)
    fileBrowserItem.children.filter { self.isItemExpanded($0) }.forEach(self.update)
  }


    }

    if fileBrowserItem.url.isDir {
      self.scanChildrenIfNecessary(fileBrowserItem)
      return self.prepare(fileBrowserItem.children).count
    }

