Fixed memory leak caused by #6 fix