Fixed a rare case where string delimiter would overflow, invalidating xml