Bug fixes. SPI efficiency improvements