first memory leak corrected