Various tweaks and fixes to improve testing.