fix possible leaks