Shortest path fix