fixed race condition in task setup
fixed race condition in task registratin