fix a memory leak