Replaced deprecated function

Will require testing - but appears to work on my 2.4 build.