possible instant disconnection bug fix. Needs testing