Fix deprecated function