Minor fixes to sp.