Fix two memory leaks, close #7