slightly improved error handling in template