A lot of bug fixes, but dijkstra does not work correctly still.
Some bugfixes