fix some async handling code