cast ptype to uint8_t since header.type is also a uint8_t. this removed one of the warnings.