using string instead of char * to avoid segmentation fault