clean up when scope is destroyed