adds cleanup code in IWillUnmount