Fix widechar-to-multibyte conversion checks