Fix invalid cast.