added some diagnostic code to show asynchronicity issue