fixed xml END_DOCUMENT bug