fix the bug that the size allocated for string is not correct