Fixed a bug when the test case gets rerun forever.