Fix build errors due to detected race conditions