Fix ruby gems loading in OSX, fix set_encoding missing in ruby 1.8.x #36