fixing concurrency issues