many template fixes