Avoid nil variables after upgrading to Ruby 2.x