fix leaks in tests