Fix assert failure due to signed/unsigned char mismatch