Various SSH fixes, fixes #262 and #223