Fix deprecated function use