Fix the path calculation