various g++ compile fixes