Fix crash when input multi-byte character by some input, update scopes after replaced multi-byte words