Fix bug when transitioning away from index route and back again.