fixed bug in ss calculation