Fix deprectated function