prototype of CRC calculation and fixing