Change to unsigned char to avoid MSVC assertion