Various fixes for building with newer gcc.