Additional memory leak fixes
Segfault fix introduced yesterday