catching template errors