Use std::string instead of CString since this avoids some memory error at exit