Fixes to build with GCC 4.7, 4.8, clang and macports