Removing dangling pointers from containers.

Improve behaviour when toggling the auto connect property of a network service continuously.