fixed some errors on dijkstra function