Fix compilation problems; fix spls; add software flow control