fix some errors and warnings on clang