sign of s changed so as to match the other code