fix issues with routing before page is ready