Fix deprecation warnings for latest scala