Fixed huge memory leak