fix bug infinite loops by spm param