optimize deprecation warnings