Fix some bugs, cache DNS results