failed flag bugfix