fixed race condition in router