fix purge_wf implementation so it takes into account dupefinders, and add unit tests