Fix memory leak (resolves #69)