Fixes to make the tests more deterministic.