Fix backwards compatibility with where.not in 4.0

Fixes #247