fix error500 and templates