fix crashing/leaking?