added hook for onConnected event