add fail handler