added onDisconnect method