Added null check for purgeusers