fix memory management issue that somehow only affected messages