Fix some warnings with Ruby 2.2

warning: possible reference to past scope