Fix clang compilation issues

Some of them still remain, but I cannot find a proper way to fix them,
and g++ seems happy.