handle invalid byte sequences