Save filter in histogram function if old histogram elements are cleaned.
More fixes for ensuring stale histogram elements are removed
Merge branch 'dev'