Add hook to run on failure