fix bug on invalid multibyte