rewrite implicit casts to new concrete cast functions