added onConnected hook