fix g++ build errors