Deal with a reentrancy issue when waiting for updates on the sockets
Fix encoding problem on input