fix subquery