Fix racy unit tests, discovered by Jenkins