Add compatibility for on_failure