work on issue #72 (memory leaks)