Fixed the memory leak. Badly