updated clear for debug mode to clear old sockets properly