fixed a concurrency bug