Fixed a bug with recomputing shortest path