Avoid use of deprecated cast.