fixed one bug when calculate the string length.