Fix a test failure and simplify cleanup