conditional cleanup

conditional cleanup