minor changes to fix concurrency issues