use uint8_t instead of unsigned char