change code for ruby 4