error handling on template fix