Handles bad queries.