Fixed some XML parsing bugs that only occurred on OSX.