third attempt for fixing a freeze child writing to the socket