Fix task state update