Make path-determination more robust