Better error messages if templating fails