Changed impl of build_path_dict