Fixed Ruby 1.8.7 syntax compatibility issues and workarounds with other gems/classes