Re-establish Ruby 1.8.7 compatibility

Although this gem appears to have been completely compatible with Ruby 1.8.7 at one time, there were a couple of places where it had drifted away from compatibility. This pull request resolves those issues.