fix typo in nextCharPos
minor simplification