fix some bug due to the diffences between cstring and string