fix concurrency issues