XML reading bug fix