Fix HTML tasks to return always to referrer when exception has been raised