implement pre-destroy