Fix restarting tasks