* query: fix query refs in top where-clause