Ruby1.9 and otherfix

Hello,

I've done some patches for Ruby 1.9, update the tests case and others minor fixes.

Thanks for your work.