fix from Craig for TEX: string length check