avoid un necessary functions run on failed case