fixed bugs in implementation of utf8Chars()