fix the bug in string_compare

fix the bug in string_compare when the string length are not equal.