Corrected a memory leak