Fix some errors and warnings when compiling with Clang