SOCKS error handling improvement

And a couple of more commits that were needed for reasonable operation for me.