fix calculation of number of XMLEntities