Fix a minor bug in spm