Multiple fixes to fix Ruby 1.8.x compatibility

Change-Id: I3acf8bb915418ba2416935291f821e99de6fc324