fix AdaptiveTemplate stream or writer