fix xml parsing bugs