simplified function set_failure and adjust_failure by differenciating failure types