Fix issue caused by asynchronous routing delaying a callback function