Fixes for building with g++