added exception handling for missing template