fix bug where utf8 characters would cause json to get cut off