Fixed bugs in route finding