Fix order of directory traversal