More precise handling of the XStream errors

relates to #657