Tweak tests to avoid race conditions.