Protect against bad queries.