Improve the robustness of path struct