Fix an error with trim on the xm handler.