fixed next(s1,s1) probelm