Fix infinite loop in path resolution.