add support for tunnelling and fix bugs and improve rubygems install