Fixed checksum calculation