added is_connected protection