compatibility back to 1.8.7

Here is the changes I did to make it run with Ruby 1.8.7. 
Ole