Fixed Ruby 1.8.7 syntax compatibility issues and workarounds to work with other gems