[#20] Code compatible with both Ruby 1.8.x and 1.9.x