fix filter_by_value not following the discard flag