add auto connection function