workaround for nested transclude scope

see #2110 for details

also added proper cleanup