make Dial function thread safe