WP-4750 fix the query