fixed issue of memory leak