Tweaks to make some test cases pass.