Philippe's patch that fixes #753. It doesn't fix #745, the connection still stalls.