Fixes for concurrency issues