fix memory behavior