Fix faulty connection handling

OTP-10126