workarounds for libxml bugs in error handling, refs #509