Error handling related to templates