os_tree and fix some bugs.