memory leak fix.