fixed race condition with token