A few changes to make tests more robust.