Fix socket bug