get rid of race conditions in test cases