Adding catch for if socket is somehow null