Fix the equal function

It failed on comparison of string object with other string object or primitive.