SPI backport from 1.5