fixed some ruby 2 upgrade bugs