fix test which fails intermittently due to race