Fix for when reading invalid XML files, added test case