memory leak final fix