fix memory leak when kill