Fixed serious concurrency bug