backport xml fixes to 0.22