Make connections_opened.js more reliable