Fix simple but significant bug in parsing XML files

Huge impact on file parsing speed