adding check for socket sync

switching undefined check to null