Fix problems caught by clang