Dijkstra Algorithm, bug fixing.