How to handle depracated function