 diff --git a/A1-board-selector-CCD.c b/A1-board-selector-CCD.c
+<<<<<<< Updated upstream
 deleted file mode 100644
 index d9c8528..0000000
 --- a/A1-board-selector-CCD.c

 {
+
+	uint8_t cmd = (a1->spi_tx[0] << 8) | a1->spi_tx[1];
 	/* ensure we push the SPI command to the last chip in chain */
 	int tx_len = WRITE_JOB_LENGTH + 2;
 	memcpy(a1->spi_tx, job, WRITE_JOB_LENGTH);
 	memset(a1->spi_tx + WRITE_JOB_LENGTH, 0, tx_len - WRITE_JOB_LENGTH);
 
-	assert(spi_transfer(a1->spi_ctx, a1->spi_tx, a1->spi_rx, tx_len));
+	bool retval = spi_transfer(a1->spi_ctx, a1->spi_tx, a1->spi_rx, tx_len);
 	hexdump("send: TX", a1->spi_tx, tx_len);
 	hexdump("send: RX", a1->spi_rx, tx_len);
 
 	int poll_len = 4 * chip_id - 2;
 
-	assert(spi_transfer(a1->spi_ctx, NULL, a1->spi_rx + tx_len, poll_len));
+	retval = spi_transfer(a1->spi_ctx, NULL, a1->spi_rx + tx_len, poll_len);
 	hexdump("poll: RX", a1->spi_rx + tx_len, poll_len);

 			/* Calc time    ar->data + 12 */
 			memcpy(&nonce, ar->data + 16, 4);
+			memset(job_id, 0, 5);
=======
-	uint8_t job_id[5];
+	uint8_t job_id[4];
 	int tmp;
 
 	int type = AVA2_GETS_ERROR;
@@ -209,7 +277,7 @@ static int decode_pkg(struct thr_info *thr, struct avalon2_ret *ar, uint8_t *pkg
 
 		memcpy(&modular_id, ar->data + 28, 4);
 		modular_id = be32toh(modular_id);
-		if (modular_id == 3)
+		if (modular_id > 3)
 			modular_id = 0;
 
 		switch(type) {
@@ -219,13 +287,12 @@ static int decode_pkg(struct thr_info *thr, struct avalon2_ret *ar, uint8_t *pkg
 			memcpy(&nonce2, ar->data + 8, 4);
 			/* Calc time    ar->data + 12 */
 			memcpy(&nonce, ar->data + 16, 4);
-			memset(job_id, 0, 5);
>>>>>>> Stashed changes
 			memcpy(job_id, ar->data + 20, 4);
 
 			miner = be32toh(miner);
 			pool_no = be32toh(pool_no);
 			if (miner >= AVA2_DEFAULT_MINERS ||
<<<<<<< Updated upstream
-			    modular_id >= AVA2_DEFAULT_MINERS ||
+			    modular_id >= AVA2_DEFAULT_MINERS || 
 			    pool_no >= total_pools ||
