Fix dijkstra distance

thanks @TeXitoi for the fix