Fix exception when reading tag