trying to fix concurrency bug