fix potential leaks