Fix undefined name 'fail'