Fix filtering expression type deduction

Fixes #243.