implement onDisconnect manually