improve key handling in SSH class