issue #126 fix potential memory leak