fixed trying to send data over the socket when there's nothing to send