bug fixes for handling non ascii strings