Fix bug related to the removal of sockets from list on disconnect