fixed foreign query filtering.
interesting query.