Fix socket timeout hang