Fixed memory leak
Worked around memory leak