Fixed invalid read when disconnecting

Need to remember to use safe versions of the linked list
for_each macros when deleting elements.