fixes to test cleanup routine