Addressing some memory leaks.