Fix one-level deep recursion when building the tree of the current directory.