Fixed compilation errors & warnings with g++ compiler.