fix memory leaks
tag for version 0.3.0