some bug fixes and impovements on route generation