add failwith to min