Move call to restart scanning thread to earlier position in connect_to_network()