Patching the disconnect and connect events.