Fix template refresh problem

Changing a template would throw an error ( when actually it should be reloading the page )