replace unsigned char with uint8_t