Fix some ruby 3 compatibility issues