Fixed checksum function to not always return 0xFF