modify sample to handle failure