Fixing bugs related to blank hostname and avoiding terminated nodes