Corrected Bug

Corrected a minor bug, in the dijkstra's implementation due to the poping elements from the list.