Pedro's patch for better error messages in XML conversion