fix compile issues and clang issues
refactoring some async stuff