better handling of parsing XML error