Some fixes for ruby 2