Adds logging for template errors and changes the event listener from onpopstate to just popstate.