Fix seg fault when checking message history.