make templates more robust