Properly encode Not filters

backport of #211