Fixed problem where strings containing multibyte characters would not be properly handled