added clean up for when child scopes are destroyed