Misc fixes for compilation with gcc