Fixed bugs. Comes out from the shortest path.