Fix deprecation warning and assorted Rubocop violations