Fix the dirIndex bug, to set it correctly based upon a depth-first traversal.