Fix concurrency problem