Fix boolean check in query.