A fix for PBUG-149, handle bad XML a bit better
Merge branch 'master' into jan_r2