Fix concurrency issues