upgrade code for spm2