Fix the construction of query condition in interactions