Fix message trimming that resulted in trailing escape backslashes