Fix exclude query contruction

My attempt at fixing #17.  Close scrutiny encouraged, as I'm still trying to get up to speed on custom database backends.