fixed errors in compare
sameOrder is done