fix a bug on stop condition handler