Return proper error and little optimisation.
Template caching.