Added fixes for Ruby 1.9

Added backward compatible updates for Ruby 1.9