Additional patch for #1279

If a message is not json, there is a possible problems in escpaing. cc #1279