Fixed race condition affecting browser back/forward buttons