Avoid use std::string::front/back for vc90 compatibility

Thank to Schmoozerd for testing and research problem.