C++ compiler portability fixes