fixed xml writer bugs