Better synchronization for tests.