fix bug on restarting a test case.