fix bug on shortest path