fixed race conditions in tests