First fix for bad connections errors

On a very bad connection this error can occur: "attempt to index field
'sock' (a nil value)"