Fix clang error and some warnings