Corrected minor bug in sma().