miscellaneous fixes to 2.3.5 code to work with ubuntu 12+ and ruby 1.9.1