Fix bugs that OnConnect and OnDisconnect are not triggered