fixed race condition with jsdom