fixing a problem where setRoute is called before creating a route