Fixed some async bugs, there are still some bugs unclear.