Fix huge memory leak