fix a major hang with nonlatin chars