Corrected the exception to catch when calling a method of a variable in a template