add OnConnect func