Fixed memory leak bug (issue #25)