shortest path calculation fixed