ssh fix and tidy up