Fixing concurrency issues