Fixed memory leak issue.