get the first matching task