Fix deprecation warning & tests failure after upgrade