main cleanup to avoid e_notice