fix signed/unsigned char mismatch