Fix socket timeout bug