moved error template stuff