Fixed a potential timing issue in a test case