fix a cocurrent bug and change to callback mode