Fix a compatibility problem with Ruby 1.8.5. Fixes issue #1004