Fixed the Dijksra algorithm and other bugs.