Fixing memory leak problem.