fix memory crash