correct crc calculation and escaping