fix some misuses of the std::string constructor and other tweaks