fix memory leak - issue #19