Small tweaks to get rid of race conditions in the tests.