Fix issue where data arrives before the socket has been set