fix a bug in the SPI driver (closes #5485)