fix template tangling problem