Fix clang compile errors and warnings