corrected checksum calculation