Fix failures with gcc 4.2
Fix warnings spotted by clang 3.5