Bug fixed! At some point in the Dijkstra algorithm it did not check whether a certain node was already added.