Fixed minor bug in Dijkstra, making it faster