improved xml parsing