Fixed bugs in finding best routes