Fix some bugs in the purging logic caused by fat fingers, ignorance
and stupidity