Bugfixes and improvements to concurrency;