fixed bug with error template and cache