Added event beforeTaskDispatched