Fix bug with calculating checksum