Fix broken connect/disconnect event handlers