conditional cleanup