added automatic purging (the purge method of mwclient does not work)