fix bugs and improve rubygems install