Fixed potential leaks.