Fix memory leak (I think)