Fix logic for filtering and packet discovery.