fix the leak memory problem