fix serious memory leak