replace_invalid_sequence