Switch to std::string::compare() from substr() in a couple of places