Bugfixes for Ruby 2.0

I tried to run it with Ruby 2.0 but it crashed. I had to fix two bugs what is contained in the first commit.

The second commit just contains some newlines in files that did not end in newlines.

The third commit just makes the compatibility solution smarter.