fix template chain