Replaced deprecated function

Will require testing - but works on my 2.4 build.