fixed the bug in PosInTextRanges::medium()