bug fix with fail()