Fixed deprecation and unused import warnings.