fixed bug with purging