autoload error handling and load templates.