Fixing wrong check in filter