move to afterDisconnect handler